
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2021 04:13 AM
Hi,
i have a br which copies the additional comments from ritm to incident.
i have a another br which copies additional comment from incident to ritm.
now the issue is because there are two business rules if i strt commenting ritm it copies to incident but the 2nd business rule again copies the same to incident.Now how to restrict i need both the br because the requirement is 2 way.
Regards,
Debasis
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2021 02:00 AM
Hi,
update as this
br on incident table--after -update
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', current.u_request_item);
ritm.query();
if (ritm.next() ) {
var curWN = current.work_notes.getJournalEntry(1);
if(ritm.work_notes.getJournalEntry(1) == '' || curWN.indexOf(ritm.work_notes.getJournalEntry(1)) <0){
ritm.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join("\n");
ritm.update();
}
}
br on ritm table
var inc = new GlideRecord('incident');
inc.addQuery('u_request_item', current.sys_id);
inc.query();
if (inc.next() ) {
gs.addInfoMessage("inside from ritm");
var curWN = current.work_notes.getJournalEntry(1);
if(inc.work_notes.getJournalEntry(1) == '' || curWN.indexOf(inc.work_notes.getJournalEntry(1)) <0){
inc.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join("\n");
inc.update();
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2021 02:00 AM
Hi,
update as this
br on incident table--after -update
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('sys_id', current.u_request_item);
ritm.query();
if (ritm.next() ) {
var curWN = current.work_notes.getJournalEntry(1);
if(ritm.work_notes.getJournalEntry(1) == '' || curWN.indexOf(ritm.work_notes.getJournalEntry(1)) <0){
ritm.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join("\n");
ritm.update();
}
}
br on ritm table
var inc = new GlideRecord('incident');
inc.addQuery('u_request_item', current.sys_id);
inc.query();
if (inc.next() ) {
gs.addInfoMessage("inside from ritm");
var curWN = current.work_notes.getJournalEntry(1);
if(inc.work_notes.getJournalEntry(1) == '' || curWN.indexOf(inc.work_notes.getJournalEntry(1)) <0){
inc.comments = current.comments.getJournalEntry(1).match(/\n.*/gm).join("\n");
inc.update();
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2021 01:51 AM
Glad to help.
Please mark response helpful as well.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-12-2024 07:52 AM
I know this is an old post, but I am attempting the same for a RITM that creates a task on a custom table. I added a field to the sc_req_item table to pull the custom table task number and vice versa. I am filtering my business rule to the following below, but is it not working as intended. Any suggestions as I am new to java script?
sc_req_item
after - update - custom request is not empty
u_(custom table)
after - update - request number is not empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2021 02:07 AM
Use before BR and use gs.isIntractive() in the condition textbox.
or we can have a zoom or gmeet?