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.

Trigger notification to CTask assigned to when plaaned start or end date changes on Change form

Nikithesh R
Tera Contributor

Hello,

When Planned Start or End date changes notification should be triggered to Ctask assigned to person. I am trying to achieve this using event trigger and BR on Ctask table, when I give condition planned start or end date changes notification is not getting triggered. Need some inputs.

Thanks.

1 ACCEPTED SOLUTION

Hi @Nikithesh R ,

 

I got it working 😁,i tried in my pdi , please refer below

 

Create before update BR on change request table,

swathisarang98_0-1709653765983.png

swathisarang98_1-1709653796257.png

 

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

	gs.info('inside br');
    var demand = new GlideRecord('change_task');
    demand.addQuery('change_request', current.sys_id);
    demand.query();
    if (demand.next()) {
		gs.info('inside if');
        gs.eventQueue('test.notify', demand, '', '');
    }
    

})(current, previous);

 

 

Event:

swathisarang98_2-1709653819780.png

Notification:

 

When event is triggered,

 

swathisarang98_3-1709653840894.png

 

Result:

swathisarang98_4-1709653951571.png

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

 

 

 

 

 

 

 

View solution in original post

13 REPLIES 13

Hi @Nikithesh R , 

 

In eventqueue instead of current.getValue('assigned_to') use below code:

 

current.assigned_to.toString()

 

add gs.info() (or) gs.log() functions to print the values

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

 

Hello @Sumanth16,

The conditions are not working, event itself is not getting triggered. 
Thanks

Hi @Nikithesh R ,

 

Please configure like below:

Screenshot 2024-03-05 at 09.49.42.png

Screenshot 2024-03-05 at 09.42.31.png

Notification 1.pngScreenshot 2024-03-05 at 09.49.59.png

Hi @Nikithesh R ,

 

I got it working 😁,i tried in my pdi , please refer below

 

Create before update BR on change request table,

swathisarang98_0-1709653765983.png

swathisarang98_1-1709653796257.png

 

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

	gs.info('inside br');
    var demand = new GlideRecord('change_task');
    demand.addQuery('change_request', current.sys_id);
    demand.query();
    if (demand.next()) {
		gs.info('inside if');
        gs.eventQueue('test.notify', demand, '', '');
    }
    

})(current, previous);

 

 

Event:

swathisarang98_2-1709653819780.png

Notification:

 

When event is triggered,

 

swathisarang98_3-1709653840894.png

 

Result:

swathisarang98_4-1709653951571.png

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

 

 

 

 

 

 

 

@swathisarang98 

Great! It is working.

Thanks for your help.