Syncing additional comments, duplicate issue

Community Alums
Not applicable

Hey Everyone, 

 

I have 2 business rules. 

 

Both are onBefore when at update when additional comments changes. 

 

We have a Global business rule on the incident table. Code is below: 

(function executeRule(current, previous /*null when async*/ ) {

    var cs = new GlideRecord('x_g_cfd_elims_cases');
    cs.addQuery('incident', current.sys_id);
    cs.query();
    while (cs.next()) {

        cs.comments = current.comments;
        cs.update();

    }

    // Add your code here

})(current, previous);

 

We have another business rule on the scope app ELIMS Integration, table extends from case. 

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
    var inc = new GlideRecord('incident');
	inc.addQuery('sys_id', current.incident.sys_id);
	inc.query();
	while (inc.next()) {
		
		inc.comments = current.comments;
		inc.update();		
	}
	
})(current, previous);

 

We added gs.getSession().isInteractive(); to the condition of the both business rules, but when a user from either the incident or case comments in additional comments, you will get a duplicate comment. Any suggestions? I can't seem to find a concrete resolution on community board. 

1 REPLY 1

bsvdnhvns
Tera Contributor

Hi @Community Alums 

 

Chek out this link How would I prevent a Business Rule from running twice  this might be useful.