getLocalIssueKeyFromRemoteId workaround SNOW -> Jira Cloud

Originally asked by Javier Pozuelo on 12 April 2024 (original question)


The getLocalIssueKeyFromRemoteId method does require a numeric ID as a parameter, so passing a non-numeric string like ServiceNow’s sys_id would not work. The method getLocalIssueKeyFromRemoteId doesn’t work for Servicenow. I need to get the issue that has the incident parent ID value in a specific custom field on Jira Cloud.

The following request work in Postman, but I cannot make it work on Exalate.

{baseURL}/rest/api/3/search?jql="Incident_key"~"INC0011036"

“Incident_key” is the name of the Jira Cloud custom field that has the key of the ServiceNow incident to which it’s connected to.


Answer by Javier Pozuelo on 12 April 2024

The following code gets the Jira Cloud issue that has the parentKey value inside the custom field “Incident_key”.

def jql = "Incident_Key~${replica.parentKey}".toString()

def localParent = new JiraClient(httpClient).http("GET", "/rest/api/3/search?", ["jql":[jql]], null, [:])