PUT method endpoint

Shalika
Tera Expert

I have integrated ServiceNow and Jira using rest message. Now I want that whenever any change is made to the incident record in ServiceNow, it should also get updated on Jira. For this I am using PUT method. The endpoint for PUT method I am using is https://***************/rest/api/3/issue/SSP-8411, where SSP-8411 is the issue ID of Jira. This is a hardcoded value. How can I use this dynamically?

1 ACCEPTED SOLUTION

Hi,

then update as this

(function executeRule(current, previous /*null when async*/) {

    try { 
        var r = new sn_ws.RESTMessageV2('Neste Siili JIRA', 'PUT');
        r.setEndpoint('https://**************/api/3/issue/' + current.correlation_id);

        r.setStringParameter('summary', 'Test Silli JIRA INT 2.0');
        r.setStringParameter('description', 'Test Silli JIRA PUT');
        r.setStringParameter('priority', 'Minor');

 

        var response = r.execute();
        var responseBody = response.getBody();
        var httpStatus = response.getStatusCode();
        gs.log("put body jira"+responseBody);
        gs.log("put status "+httpStatus);
    }
    catch(ex) {
        var message = ex.message;
    }
})(current, previous);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

12 REPLIES 12

Anjaneyulu Muv1
Tera Expert

Hi Shalika,

 

use url is like https://***************/rest/api/3/issue/${id}

while calling this rest message pass this parameter like

request.setStringParameter("id","SSP-8411"); 

 

Shalika
Tera Expert

It is showing error as invalid endpoint

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

You must be storing the JIRA Issue ID initially when new incident is created.

Which field of incident table is holding that? you can use that to get that value

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Please correct me where I am wrong