Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Display previous caller name in notification

Vijay Baokar
Kilo Sage

Hello Everyone.

 

I have a scenario, when i am changing the caller to new user then system should trigger notification to new caller with name of previous caller in the mail body.

BR:

gs.eventQueue('incident.caller.changed',inc, inc.caller_id,current.user_name);
 
Notification:

Dear User,

${number} has been reassigned to you because previous caller ${parm2} is no more active in the system, Please take necessary action.

 
Result:

Dear User,

INC0009005 has been reassigned to you because previous caller is no more active in the system, Please take necessary action.

 

Expected:

Dear User,

INC0009005 has been reassigned to you because previous caller David Miller is no more active in the system, Please take necessary action.

 

 

Thanks.

IT Service Desk.

1 ACCEPTED SOLUTION

Community Alums
Not applicable

@Vijay Baokar ,

You mentioned like ${parm2}  but you you have to mention like ${event.parm2} because both the parm1 and parm2 are part on event object.

So your email body is like 

${number} has been reassigned to you because previous caller ${event.parm2} is no more active in the system, Please take necessary action.

Note: Use my business rule script because I mentioned previous in parm 2

 

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

Thanks and Regards 

Sarthak

View solution in original post

5 REPLIES 5

Vengadesh
Tera Guru

Hi @Vijay Baokar 

 

You can get the previous caller using the previous parameter(previous.caller_id) and pass it as parameter 2

Community Alums
Not applicable

Hi @Vijay Baokar ,

I tried your problem in my PDI and it works for me 

Please check your BR to 

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

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


})(current, previous);

 

And make your notification body like this 

SarthakKashyap_1-1715166408484.png

 

Result 

SarthakKashyap_0-1715166378009.png

 

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

Thanks and Regards 

Sarthak

 

Community Alums
Not applicable

@Vijay Baokar ,

You mentioned like ${parm2}  but you you have to mention like ${event.parm2} because both the parm1 and parm2 are part on event object.

So your email body is like 

${number} has been reassigned to you because previous caller ${event.parm2} is no more active in the system, Please take necessary action.

Note: Use my business rule script because I mentioned previous in parm 2

 

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

Thanks and Regards 

Sarthak

@Community Alums thanks for the responses, I have tried below script but this time notification didn't trigger . I have written this BR on sys_user table when active changes to false.

 

var user = current.getValue("sys_id"); // Inactive user
var inc = new GlideRecord("incident");
    inc.addEncodedQuery("active=true^caller_id=" + user);
    inc.query();
    while (inc.next()) {
        manager = inc.caller_id.manager.toString();
        var watchlst = inc.watch_list.toString();
        var newWatchlst = watchlst.replace(user, manager);
        inc.watch_list = newWatchlst;
        inc.caller_id = manager;
       
        inc.update();

        gs.eventQueue('incident.caller.changed',current, current.caller_id.getDisplayValue(),previous.caller_id.getDisplayValue());
    }
 
Note: current.caller_id.getDisplayValue() must be referring to incident record but this BR is on user table.
 
Notification:

Dear User,

${number} has been reassigned to you because previous caller ${event.parm2} is no more active in the system, Please take necessary action.