- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2022 07:53 AM
Dear Team,
We have business rule : Jira_Webhook_Commentsupdate.
This rule should ideally gets triggered when someone updates the comment on Incident, and the Jira_ref_id field is not empty i.e. have value.
In regular scenarios i.e.: when someone updates comment using Incident form, the trigger works fine and BR gets executed as expected.
But when someone updates the comments via email , the BR gets executed twice and we are unable to identify if this is something to do with BR filter, as only single comment gets updated on INC via email, then why BR runs two times.
Any advise on this, why BR triggers twice when comment gets updated via email?
Attached rule.
Regards,
Hanumant
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-09-2022 02:28 AM
Hi All,
We resolved this by moving field action from UI under action tab into the Script and this got resolved.
Not sure what field action in Action tab was causing, but this is now resolved.
Regards,
HM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2022 10:23 AM
Hi Shlok,
Thank you!
Here is BR for Jira Update call:
(function executeRule(current, previous /*null when async*/ ) {
try {
var r = new sn_ws.RESTMessageV2('JIRA_Integration', 'Update_Issue_Comments');
r.setEndpoint('https://JiraURL/pro/hooks/44e651283dbdfaa48422ce6e1cb700ee8eadert456?issue=' + current.u_jira_ref.getDisplayValue());
var comms = current.comments.getJournalEntry(1).toString();
comms = String(comms);
var comms1 = JSON.stringify(comms);
r.setStringParameterNoEscape('comments', comms1);
var response = r.execute();
var requestBody = r.getRequestBody();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log(requestBody);
} catch (ex) {
var message = ex.message;
}
})(current, previous);
And here is the inbound action code:
gs.include('validators');
if (current.getTableName() == "incident") {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
if (current.incident_state == 6) {
if (email.subject.toLowerCase().indexOf("please reopen") >= 0) {
current.state = "1";
current.work_notes = "The caller did not feel that this issue was resolved";
current.close_code = "";
current.close_notes = "";
current.assigned_to = "";
}
}
if (email.subject.toLowerCase().indexOf("resolved") >= 0 && current.state != 7 && current.state != 6 ) {
current.state = "6";
//current.category = "Infrastructure";
//current.subcategory = "Connectivity";
current.close_code = "Loss of Service";
current.close_notes = "reply from: " + email.origemail + "\n\n" + email.body_text;
//current.cmdb_ci = "Vendors Management";
//current.setDisplayValue('cmdb_ci',"Vendors Management");
}
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}
if (!gs.hasRole("itil")) {
current.u_follow_up_date = '';
}
current.update();
}
Regards,
Hanumant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 02:10 AM
Hi
I don't see an issue with your Inbound action code here. But let's debug this and see how it goes.
Looking at your BR, looks like the comments you are trying to post is via Integration from JIRA. Can you please make this BR as a Async BR instead of using After or Before here and try again.
Secondly, can you put a log in the first line of the BR and check how many times this BR got executed?
Also put a log in your Inbound action code just after this line:
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
See how many times it is getting executed.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 05:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 07:45 AM
Okay sure
Can you do one thing on your Incident table , Can you disable All other After Update Business Rule just leaving the one which you are using and shared above.
This is one of the way I do in my project when nothing clicks and try again. Once it works, try enabling other BR one by one and test it out.
this way you will be able to eliminate the culprit BR which is causing this and once identified , you can tweak the condition so that it does not coincides with your New BR.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2022 02:23 AM
Hi Shlok,
Any suggestion here.
Regards,
Hanumant