How to setup a notification for the Task Assigned To from a change on the Request?

Luke Dibben1
Kilo Contributor

Hi all,

How would I set up the Service Catalog such that when a user adds a comment to Additional Comments (On the Request), an email notification is sent to the Assigned To (On the Task)?

Regards,

Luke

16 REPLIES 16

Hi Luke,



Here is the sample code for reference. Please add additional addQuery to filter the exact task.


var gr = new GlideRecord('sc_task');


gr.addQuery('request', current.sys_id);


//Here add one more query to filter the exact task


gr.query();


if(gr.next())


  {


  var assigned_to = gr.assigned_to;


  gs.eventQueue(eventname,current,param1,param2); //This is just syntax


}



Reference :


GlideRecord - ServiceNow Wiki


Hi Pradeep,


What if we want the notification to go to the Assigned To: of ALL of the Requested Item's Tasks?



Regards,




Luke


In that case you the above query will work as it will query all the tasks.


Just add additional query to filter only active records.


gr.addQuery('active',true);


Luke Dibben1
Kilo Contributor

Hi Pradeep,


Thanks so much for your help! I have tried as you said but the message does not send. I have added as a test, my own email address to the Notification 'Who will Recieve" and the Notification is triggered under the correct circumstances, it just wont send to the Task Assigned To:.



Below is how I have it setup:



Notification


find_real_file.png


find_real_file.png


Event


find_real_file.png


Business Rule


find_real_file.png


find_real_file.png


find_real_file.png


Any idea's?



Regards,



Luke


Can you make sure send to event creator is checked to true. Click on related link in email notification to check for this field under "who will receive" tab