Questions for Confluence license has expired.

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

script for desciption from last comment

 
1
0
-1

Hi,

i have a zd<>Jira connection.

i need the jira's description to take on the last comment from ZD, at the time of first sync only. 

can you advise a script?



    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      It is easy to get the last comment from the comment array using following snippet in the outgoing sync on the zendesk side


      def lastComment = issue.comments?.getAt(-1)
      replica.description =  lastComment
      // use next to check the result of the statement - this generates an error.debug.error("Replica description = ${replica.description}")
      1. Francis Martens (Exalate)

        You might also be interested in  only send the comment set from the moment of the exalate



        It is an advanced configuration with a message dance to store a local value.

      2. ben friedman

        thanks Francis,

        i've added that and now getting an error on the Jira side - 

        Internal comments cannot be processed. The reason is: Request Type custom field is required, but not set..


        ive tried to set the following, but to no success -


        on["""avo"""].issue.customFields."Customer Request Type".value = "Customer Support request"

      3. ben friedman

        Hi Francis, i've followed the guide, and now have the below, but it still produces an error:


        if (firstSync) {
            on["""avo"""].issue.customFields."Request Type".value = "Customer Support request"
        }

        def lastComment = issue.comments?.getAt(-1)
        on["""avo"""].description =  lastComment
        // use next to check the result of the statement - this generates an error.
        debug.error("Replica description = ${replica.description}")

      4. Ariel Aguilar

        Hi there,

        Let me help here, I checked on the logs and found the error:

        "Caused by: com.exalate.api.exception.script.IssueTrackerScriptException: Replica description = סתם מידע"

        So, you need to do the following to make it work:

        if (firstSync) {
            on["""avo"""].issue.customFields."Request Type".value = "Customer Support request"
        }
        def lastComment = issue.comments?.getAt(-1)
        on["""avo"""].issue.description =  lastComment

        The word "issue" on the last line was missed before. Try out and let me know.

        Kind regards,

        Ariel

      CommentAdd your comment...