Sync Jira Service Management customer portal URL to Server

Originally asked by Jillani Fazal on 08 December 2022 (original question)


Can Exalate sync JSM Cloud customer portal URL to Server ? Exalate can sync agent view URL ( https://synacsm.atlassian.net/browse/CSMTBAPO-219) but we want to sync this customer view URL ( https://synacsm.atlassian.net/servicedesk/customer/portal/365/CSMTBAPO-219 ) .

My internal users want to access JSM tickets on JSM cloud via customer portal URL when they browse internal JIRA ticket. Exalate does provide the URL of the issue. I wonder Exalate can provide the customer portal URL or not.

For example, Exalate can show issue.url (it is a JIRA Automation smart value. It is the URL of the issue) but I need issue.url.customer ( it is a JIRA Automation smart value. It is the customer portal URL for Jira Service Management requests).

Would you advice a script?

(Asked on the behalf of the client)


Answer by Jillani Fazal on 09 December 2022

Hi Tony Please add the following script in the sync rules:

Outgoing Sync

def url=""
def js= new groovy.json.JsonSlurper()
  def subtaskKeys = new JiraClient(httpClient)
    .http("GET", "/rest/servicedeskapi/request/${issue.key}", [:], null, [:])
   { response ->
   if (response.code >= 400) debug.error("POST /rest/api/2/issue/${issue.key}/comment failed: ${response.body}")
                else {
                                        def json = js.parseText(response.body)

                    url=json.get("_links").get("web")
                    //debug.error("response here: ${response.body}"+"---links:"+json+"---res:"+res)
                }
  
  
}
replica.customKeys."JSM Customer URL"=url  
  

Incoming Sync:

if(firstSync){
   issue.projectKey   = "CSM" 
   // Set type name from source issue, if not found set a default
   issue.typeName     = nodeHelper.getIssueType(replica.type?.name, issue.projectKey)?.name ?: "New Feature"
   syncHelper.syncBackAfterProcessing()

}  
  

target non-JSM side:

incoming sync:

issue.customFields."JSM_URL".value=replica.customKeys."JSM Customer URL".toString()
Let me know the outcome.   
  
BR,   
Jillani