
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 02:17 PM
I have an REST API integration between SN and Optanix that I am trying to get working correctly.
Here is the info:
I have a Business Rule that get the comments that was entered and send via REST API to Optanix using PUT method.
When I posted a comment from Optanix and send to SN, what will SN does is it will send that comment back to Optanix.
The issue is that both side sees the comment as a new comment and starts to keep updating the same comment repeatedly.
My BR When to run:
I tried using before Update, after Update both failed and async too 😞
My BR conditions:
My BR Script:
(function executeRule(current, previous /*null when async*/) {
try {
gs.log("SN - Sample TEST API Update");
var r = new sn_ws.RESTMessageV2('Optanix Incident Management', 'Optanix - Incident PUT');
r.setStringParameterNoEscape('number', "number: " + current.number + ", sys_id: " + current.sys_id);
r.setStringParameterNoEscape('correlation_id', current.correlation_id);
r.setStringParameterNoEscape('incident_state', current.incident_state);
r.setStringParameterNoEscape('description', current.description);
r.setStringParameter('work_notes', current.work_notes.getJournalEntry(-1).replace(/(\r\n|\n|\r|_123STREAMENTRY321_)/gm,""));
r.setStringParameter('comments', current.comments.getJournalEntry(-1).replace(/(\r\n|\n|\r|_123STREAMENTRY321_)/gm,""));
r.setStringParameterNoEscape('priority', current.priority );
r.setStringParameterNoEscape('category', current.category);
r.setStringParameterNoEscape('impact', current.impact);
r.setStringParameterNoEscape('short_description', current.short_description);
//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthenticationProfile(authentication type, profile name);
//set a MID server name if one wants to run the message on MID
//r.setMIDServer('MY_MID_SERVER');
//if the message is configured to communicate through ECC queue, either
//by setting a MID server or calling executeAsync, one needs to set skip_sensor
//to true. Otherwise, one may get an intermittent error that the response body is null
//r.setEccParameter('skip_sensor', true);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
catch(ex) {
var message = ex.message;
}
})(current, previous);
Is there a way to prevent SN from sending back the comments from Optanix platform?
What should I add/remove or change from my BR to make this work correctly?
Your help on this will be much appreciated, Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 03:03 PM
Please add - gs.getSession().isInteractive() in the condition of your business rule.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 03:01 PM
You need to add condition in your business rule to verify that incident is NOT updated by Optanix platform.
I hope you have local service account for Optanix interface on your instance.
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2020 03:03 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2020 08:50 AM
Hi kumamano,
Everything worked as expected. Thank you so much! 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 04:02 AM
Thanks Manoj. It works with the Business Rule. But I am facing the infinite loop while using the flow designer. Help me with that.