Questions for Confluence license has expired.

Please purchase a new license to continue using Questions for Confluence.

How to set a scripted field

 
1
0
-1

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



if (syncHelper.isIssueUnderSync(issue.key)){
    issue.customFields."Aha! Sync (UI)".value = "Yes"
}
    
    log.warn("INCOMING4=== "+issue.customFields."Aha! Sync (UI)".value)



    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      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.


      1. Mouna Hammoudi

        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. 

      2. Francis Martens (Exalate)

        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.


      3. Mouna Hammoudi

        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"
        }
      4. Mouna Hammoudi

        ScriptRuner.PNG


        As you can see in this screenshot we cannot write any ScriptRunner script for a text field 

      CommentAdd your comment...