
- 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:55 PM
Your previous code also had some current updates, where is this now? Or did you update your code? Is the updated code also performing better? If so, indeed: check the conditions of the Business Rule. I think it's just getting triggered over and over.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-29-2020 05:26 AM
Hi there,
Still any help needed? Or did you manage with my responses?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2020 04:26 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2020 06:00 AM
Hi Dirk,
Appreciate your response. I'm not sure about this process. If you have any good reference links on this topic, can you please share them here. Paralelly i will aslo check for some resources.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2020 01:45 PM
Hi
Can you share a screenshot of you BR?
Does it fire before or after?
Does is fire on insert and/or update?
What happens when you leave out the "current.update()"?
PLEASE, remember to try this only on non production instances.
Thanks for letting me know.
BR Dirk