Flow Design to trigger reminder email and send email to Opened for/Caller - script not working?

Winnie P
Mega Sage

Hello Team,

I created a Flow Design to send out approval email reminders every 7, 14, 30 days etc.  The reminder notifications (using sysApproval table) to the Approver is being sent and is working fine. However, I also need to send the same email to the Caller/Opened for of the Request, this part is not working.  I added a script to the Flow as follows:

find_real_file.png

 

The Request to fetch the Caller or Opened for name from the Request ie:

 

find_real_file.png

I also tried this, which does not work either:

var callerid = fd_data.trigger.current.sysapproval.getDisplayValue();
var gr = new GlideRecord('facilities_request');
gr.addQuery('number' , callerid);
gr.query();
while (gr.next())
{
var callerid = gr.request.caller.sys_id;
}
return callerid;

 

Any assistance would be much appreciated. Thank you.

1 ACCEPTED SOLUTION

Hi,

use this script

I assume you have caller as reference field on table facilities_request

var sysId = fd_data.trigger.current.sys_id;

var rec = new GlideRecord('sysapproval_approver');
rec.get(sysId);

var callerid;
var gr = new GlideRecord('facilities_request');
gr.addQuery('sys_id', rec.sysapproval).addOrCondition('sys_id', rec.document_id);
gr.query();
if(gr.next())
{
	callerid = gr.caller.sys_id;
}
return callerid;

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Glad to help.

Please mark response helpful as well.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Adam Peterson
Kilo Sage

@Winnie P Can you show me how you are sending out e-mails every 7, 14, 30 days. I am trying to accomplish this but having a hard time. Thanks! 

Hello there, this is our Flow that works for us:

WinniePoelima_0-1680821797263.png

This is Action 4 Trigger Event to send reminder emails to Approver/s:

WinniePoelima_1-1680821846349.png

This is action 5 to send reminder email to Requester:

WinniePoelima_2-1680821904689.png

And this is the Event Parm1 script we had to add:

WinniePoelima_3-1680821963687.png

Cheers.