
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2020 08:14 AM
Hello Everyone,
I have a business scenario where if i create an incident in InstanceA, it should create an incident in InstanceB. Also, any updates made to an incident in InstanceA should also reflect in InstanceB. I have configured a REST message and also a Business Rule. The problem is, i have used current.update() at the end of my BR and its causing performance issues while executing insert/update actions. Is there any alternative to this method to achieve back my performance?
Below is my BR
(function executeRule(current, previous) {
var r = new sn_ws.RESTMessageV2('ABC to MSP Rest Message ', 'ABC to MSP');
r.setStringParameterNoEscape('u_short_description', current.short_description);
r.setStringParameterNoEscape('u_impact', current.impact);
r.setStringParameterNoEscape('u_configuration_item', current.cmdb_ci);
r.setStringParameterNoEscape('u_incnumber_abc', current.number);
r.setStringParameterNoEscape('u_subcategory', current.subcategory);
r.setStringParameterNoEscape('u_caller', current.caller_id);
r.setStringParameterNoEscape('u_sysid_abc', current.sys_id);
r.setStringParameterNoEscape('u_urgency', current.urgency);
r.setStringParameterNoEscape('u_category', current.category);
r.setStringParameterNoEscape('u_description', current.description);
var response = r.execute();
var responseBody = response.getBody();
var parsed_response=JSON.parse(responseBody);
var id =parsed_response.result[0].sys_id;
var id1 =parsed_response.result[0].display_value;
current.u_msp_incident_sysid = id;
current.u_msp_incident_number = id1;
current.update();
var httpStatus = response.getStatusCode();
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2020 08:28 PM
I have figured out the problem for this unexpected behavior. It was in my HTTP method where i have given an extra space in one of the variable declaration. Once i rectified that everything is working as expected.
Thanks everyone for your response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2020 09:30 PM
Hi Dirk,
I have figured out the problem for this unexpected behavior. It was in my Http method where i have given an extra space in one of the variable declaration. Once i rectified that everything is working as expected.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2020 01:44 AM
Hi
Try this one:
ebonding should the one of the options of your choice (which uses Flow Designer and Integration Hub as Platfrom technology to integrate TWO ServiceNow Instances to exchange Incident data).
Let me know if that answers your question and mark my answer as correct/helpful, please.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2020 10:14 PM
Hi,
If the business rule is before insert or update BR, then system automatically does an update on the database when the script runs, and it doesn't need another current.update() in the script.
If my answer helped you, mark answer as helpful and correct.
Thanks and regards,
Megha.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2020 08:28 PM
I have figured out the problem for this unexpected behavior. It was in my HTTP method where i have given an extra space in one of the variable declaration. Once i rectified that everything is working as expected.
Thanks everyone for your response.