Trigger after insert BR only when condition satisfy

tanz
Tera Expert

Hi,

 

I have created a after insert and update BR with filter conditions as assignment group is AB.

I have created two functions in script include which is called by the BR when record is inserted or updated.

 

Now the insert function should trigger only when the above condition gets satisfied for the first time and from next time onwards it should trigger the update function(because the condition has already been satisfied once and insert was trigerred)

if(current.operation() == 'insert'){
call function A();
}
else if(current.operation() == 'update'){
call function B();
}
But it is always calling update function. Could ou please help on resolving the issue.
4 REPLIES 4

Prince Arora
Tera Sage
Tera Sage

@tanz 

 

This cant be possible, I have tried in my PDI it is working properly

 

Can you try creating two BRs, One is with after-insert and second is with after update and call the script there accordingly

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

The update is not the problem, but the insert shuld happen only once the assignment group is AB. Also please note that the assignment group for the ticket is initially not AB but is changes to AB manually only after the ticket is created

Harsh_Deep
Giga Sage
Giga Sage

Hello @tanz ,

 

Please check the screen shots, for me this is working fine.

Harsh_Deep_0-1701168750454.png

 

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

    // Add your code here
    if (current.operation() == 'insert') {
		gs.info("@@Harsh BR Insert");
    } else if (current.operation() == 'update') {
		gs.info("@@Harsh BR Update");
    }

})(current, previous);

Harsh_Deep_1-1701168787872.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

Once you add an assignment group in filter this is not working. Also the use case is change the assignment group to AB only after the ticket is created.

This is actually considered an update not an insert. could you please help with suggestion here.