- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2020 04:11 AM
Hi Anu,
You can copy the code from Preview script usage in REST Message and paste the same in your business rule.
You can create async business rule for same.
PFB code for your reference
try {
var r = new sn_ws.RESTMessageV2('Demo','Create Incident');
r.setStringParameterNoEscape('Description',current.description);
r.setStringParameterNoEscape('impact',current.impact);
r.setStringParameterNoEscape('short_description',current.short_description)
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var responseObj = JSON.parse(responseBody); //Parse response body
var inc = responseObj.number; // get the incident number of target instance
current.correlation_id = inc; // save the number in correlation id field
current.setWorkflow(false);
current.update();
}
catch(ex) {
var message = ex.getMessage();
}
Hope it helps.
Regards,
Monika