1
0
-1

We have written the logic from ServiceNow to Jira sync where we are trying to set
i. Jira state to " Resolved"
ii. Copy Resolution Code and Notes to Jira
Here is our Jira Service Management Incoming sync Logic
Can anyone help us to know what we are missing here?


def localStatus = null
if (replica.close_code == "Not Solved (Declined)") {
    localStatus = "WAITING FOR SUPPORT"
    
    syncHelper.unExalateAfterProcessing()
} else if (replica.close_code == "Closed/Resolved by Caller") {
    localStatus = "Canceled"
} else {
    def statusMap = [
            "Resolved": "Resolved"
    ]
    def remoteStatusName = replica.status ?.name
    localStatus = statusMap[remoteStatusName]
}
if (localStatus) {
    issue.setStatus(localStatus)
}
issue."Close Code" = replica.close_code
issue."Close Notes" = replica.close_notes
if (replica.close_notes && replica.close_notes != previous.close_notes) {
    def comment = commentHelper.addComment(replica.close_notes, [ ]).find()
    comment.internal = false
    comment.executor = nodeHelper.getUser("Jira Service Desk key") //Jira Service Desk Agent
    issue.comments += comment
}


Any advise will be greatly appreciated!


Thanks,


Olimpia Estela and Vaihnavi Shinde

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Sonal, 

      Thanks for your quick response on our Question. We tried changing the Jira incoming code as you mentioned but still it doesn't really worked for us. 


      Here is the ServiceNow Outgoing logic


      if (entity.tableName == "incident") {
          if ((entity.state == "Resolved")) {
              replica.close_code = entity.close_code
              replica.close_notes = entity.close_notes
          }
          replica.status = entity.state
          replica.IST_Incident_Number = entity.number
          replica.attachments = entity.attachments
          replica.comments = entity.comments
          replica.IST_Status = entity.state
          replica.urgency = entity.urgencyValue
          replica.impact = entity.impactValue
      } 


      Can you please help us knowing where we are missing. 

      1. Sonal Otwani

        Hi Vaishnavi ,


        So in this case you need to use:


        def remoteStatusName = replica.status


        Let me know if this will work or not.


        Thanks and Regards,

        Sonal

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hi Olimpia Estela Caceres-Brown,


      Can you please check what is the script in your outgoing sync of ServiceNow regarding status field?


      Mostly it will contain following script (let me know if it is different):

       replica.state          = entity.state

      In this case, the incoming sync script will be:

          def remoteStatusName = replica.state

      instead of:


      def remoteStatusName = replica.status ?.name


      Let me know in case it will not work after this line change.


      Thanks,

      Sonal

        CommentAdd your comment...