Originally asked by Francis Martens (Exalate) on 06 April 2022 (original question)
I am using this code in my incoming exalate sync connection. The If statement is true and it goes inside the If and the value of the “Aha Sync (UI)“ custom field is indeed set to “Yes“. I have checked in the log file with the log.warn statement. However, when I check my Jira UI, the custom field is not shown as it does not have any value, it is empty. Is this a bug on your side or am I doing something wrong. By the way I am using a scripted field
Answer by Francis Martens (Exalate) on 06 April 2022
There is no api to set the scripted field as these don’t have storage associated to it.
The fact that you see the value in the logging is because the issue object in the incoming sync is an advanced map. Once that the incoming sync script is executed, exalate will apply all the changes of the map onto the real issue.
There might be a trace of it in the logging.
Instead of a scripted field, our advise is to use a normal custom field.
Comments:
Mouna Hammoudi commented on 06 April 2022
Thanks for your answer but I need to have a scripted field because I want to show “Yes” if the issue is synchronized. Otherwise, if the issue is not synchronized, I would like to have a link that would redirect the user to the REST API upon clicking on it and that would trigger an exalation upon clicking on it. This can only be done with a scripted field.
Francis Martens (Exalate) commented on 06 April 2022
Whatever you add to a scripted field can also be added to a normal field.
Can you provide a code snippet, which sets a scripted field when executed in the scriptrunner console. If you have this, getting it implemented in Exalate is straightforward.
Mouna Hammoudi commented on 06 April 2022
I would like the content of my text field to take two possible values:
show text if it is synchronized
show link “Exalate” if it is not synchronized, clicking on this link would enforce the exalation process through a REST endpoint
Using a regular single line/multi line text field only allows you to set text and does not allow the option for displaying a link.
I have used this code where Aha! Sync (UI)2 is a multi line text field and that works, it shows “Yes” as a text. But this is not what I want, I want the value to be shown to be either text or a link “exalate”, clicking on the link exalate should trigger a JIRA REST endpoint that would enforce the exalation process
if (syncHelper.isIssueUnderSync(issue.key)){
issue.customFields."Aha! Sync (UI)2".value = "Yes"
}