Passing comments From Task to RITM & RITM to Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-26-2024 11:59 AM
Hi All,
I have two business rules set up - one for passing comments from a Requested Item (RITM) to a Task, and another for passing comments from a Task to an RITM.
Two Business rules are active only. Both are the same Condition: current.comment.changes()
1. RITM to Task
if I enter a comment in RITM it will display in the task comment.
2. Task to RITM
if I enter a comment in the task it will display in the RITM comment.
Two business rules are triggering at the same time. So that same comment is passing from RITM to task and also from Task to RITM.
- if a comment from RITM to a Task it should not trigger a business rule(Task to RITM).
- if a comment from Task to a RITM it should not trigger a business rule(RITM to Task).
What is the solution to prevent the repeating comments?
Task comment section:
RITM comment section:
Thanks,
Subash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2024 11:30 PM
Hi @subashds6515 ,
Sorry i just got some different approach can u give that a try maybe u can remove the condition for current.table_name & just keep comment changes n in ur script before update just use gr.setWorkflow(false). This will stop the other BR from executing & only once ur comment will be updated.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 09:48 AM - edited 01-28-2024 09:50 AM
@subashds6515 , try with this and condition would be same as comments changes
1. After Insert/Update business rule that runs on RITM table when Comments | changes
var com = "RITM Comments for " + current.number + " : " + current.comments;
if(com.indexOf('RITM Comments')>-1 && com.indexOf('Catalog Task comments')==-1)
{
var cattaskis = new GlideRecord('sc_task');
cattaskis.addQuery('request_item', current.sys_id);
cattaskis.query();
if (cattaskis.next()) {
cattaskis.comments= "RITM Comments for " + current.number + " : " + current.comments;
cattaskis.update();
}
}
2. After Insert/Update business rule that runs on SC Task table when Comments | changes
var com = "Catalog Task Comments for " + current.number + " : " + current.comments;
if(com.indexOf('RITM Comments')>-1 && com.indexOf('Catalog Task comments')>-1)
{
var ritmis= new GlideRecord('sc_req_item');
ritmis.addQuery('sys_id', current.request_item);
ritmis.query();
if (ritmis.next()) {
ritmis.comments= "Catalog Task Comments for " + current.number + " : " + current.comments;
ritmis.update();
}
}
Regards,
Shyam Kumar
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 09:51 AM
You could do a gs.isInteractive() on both business rules as a condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 12:40 PM
i should have mentioned, for this trick to work, you need to set both business rules to async