Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Dynamic Recipients in Scheduled Report

Cris AD
Tera Contributor

Hello Community,

 

I need to update the field Users ( the recipients) in the form of one scheduled report to be dynamic values.

 I have created the scheduled report with one user because this one will be always as default, but I need to add more users  to the list.

I have selected the "conditional" option to create one script that makes a query to a table, I get an array variable with all the sysid for the users as unique. 

So when I run the script on background to verify the values, I got the correct sysids :

example:

 *** Script: assignedUnique = ed83fc7a1b0633806278edf9bc4bcb12,978178521baa77846278edf9bc4bcbdf,ce47701e1bae77846278edf9bc4bcbee, etc

 

so when I try to update the current form for the scheuled report to add the new recipients nothing changes and only send the report to the original default user that I put manually.

 

 

this is  my code that Im using to update the Users field on the scheduled report form:

but when I execute it, nothing happens and is only sending the notification to first user that I enter manually in the field, is not adding/updating the other recipients, its like the script was ignored.

 

Any idea how can I make this work?

 

Regards

1 ACCEPTED SOLUTION

Sagar Pagar
Tera Patron

Hello,

Please refer this article: Scheduling a report for dynamic Recipients based on the table column of the report

 

Regards,

Sagar Pagar

The world works with ServiceNow

View solution in original post

3 REPLIES 3

Tony Chatfield1
Kilo Patron

Hi, without clear details of your code it's difficult to assess your solution, but I would think a notification email mail script that populates recipients via the email.addAddress method would be your best/easiest way forward.

https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/script/server-scripting/reference...

You would need to dot.walk to the users email addresses, either directly via the user record or via their Notification devices (depending on your configuration).

Bhavik M
ServiceNow Employee
ServiceNow Employee

The following community article should help 

 

https://community.servicenow.com/community?id=community_question&sys_id=c8cfcb65dbdcdbc01dcaf3231f961971

https://community.servicenow.com/community?id=community_article&sys_id=873319531b8b98508672ea89bd4bcb64

 

Sagar Pagar
Tera Patron

Hello,

Please refer this article: Scheduling a report for dynamic Recipients based on the table column of the report

 

Regards,

Sagar Pagar

The world works with ServiceNow