Email notification after delete

sachin_namjoshi
Kilo Patron
Kilo Patron

Hi All,

I need to send notification after record is deleted from table.

Following is my scenario.

When project is removed from portfolio, portfolio manager should receive notification.

Project and portfolio relationships are stored in pm_m2m_portfolio_project table and this table is referenced in related list on portfolio form.

Hence, i created after delete business rule on pm_m2m_portfolio_project table which generates event. This event is handled in email notification.

But, i am facing issue here and event will not be processed since record in already deleted from pm_m2m_portfolio_project table.I won't get current, previous object in business rule since record is already deleted.

I tried to set value of portfolio manager in on after delete business rule before sending event.But, it's not working and event is not getting processed.

Also, i tried to set value of portfolio manager in on before delete business rule with no success.

Another option was to create BR on Audit deleted records table and create mail script to parse payload XML for email content.But, this will not work in this case since payload doesn't contain portfolio manager name.

Please let me know solution to this issue.

Regards,

Sachin

1 ACCEPTED SOLUTION

Thanks for the update.


You could JSON encode an object and pass it in the parameter, then use a mail script in the notification


Reference :   by sabell2012


Mini-Lab - Events: Passing Objects


View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Sachin,



Try to pass "null" instead of "current" when you create the event.


gs.eventQueue("PASSEVENT NAME HERE", null, "parm1", "parm2");  


Events and Email Notification - ServiceNow Wiki


Thanks Pradeep!!



Now, i am able to get event processed successfully.


How can i get deleted record details ( project manager name, project manager in email notification which is handling this event?



Regards,


Sachin


Thanks for the update.


You could JSON encode an object and pass it in the parameter, then use a mail script in the notification


Reference :   by sabell2012


Mini-Lab - Events: Passing Objects