Display previous value of priority field

Shir Sharvit
Tera Contributor

Hey

I need to display in the body of the notification the previous value of the priority field in the Incident form.

 

I would appreciate help on how to do this

Thanks, Shir.

9 REPLIES 9

Community Alums
Not applicable

Hi @Shir Sharvit ,

In code we are sending 2 parms

1. Current.caller_id

2. previous.priority

gs.eventQueue('incident.caller.changed',current, current.caller_id.getDisplayValue(),previous.priority);

 

What are you sending in parm1 and parm2 ? 

Please mark my answer correct and helpful if this works for you

Thanks and Regard s

Sarthak

this business rule:

ShirSharvit_0-1718281442369.png

 

this event: 

ShirSharvit_1-1718281505954.png

 

and this notification:

ShirSharvit_2-1718281529068.png

 

ShirSharvit_3-1718281620517.png

 

What am I doing wrong that it doesn't work?

Community Alums
Not applicable

Hi @Shir Sharvit ,

In BR you mentioned like 

gs.eventQueue('incident.caller.changed',current,previous.priority.getDisplayValue());

Which is wrong syntax. You need to pass 1 glideRecord and 2 parms 

gs.eventQueue('incident.caller.changed',current,parm1, parm2);

You can try this- 

gs.eventQueue('incident.caller.changed',current,current.number, previous.priority);

 

In Subject you have to pass parm2 bcoz it contains the value of priority

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak

Hey
I didn't understand what to fix for it to work in BR

 

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

    var previousPriority = previous.getDisplayValue('priority');

    gs.eventQueue("incident.priority.changed", current, current.priority, previousPriority);



})(current, previous);

Community Alums
Not applicable

Hi @Shir Sharvit ,

Please update your BR with below code 

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

	// Add your code here
	gs.log("CHECK priority = " + current.priority.getDisplayValue() + " ________ "  + previous.priority.getDisplayValue());
	gs.eventQueue('incident.caller.changed',current, current.priority.getDisplayValue(),previous.priority.getDisplayValue());


})(current, previous);

Result 

SarthakKashyap_0-1718349254669.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak