Email notification based on record producer variable?

Community Alums
Not applicable

Hi All,

I currently have various record producers set up, when completed, an email notification is sent to specific emails with the input of all variables within the record producer.

This is set up via an event, a business rule and a notification all within a custom application - this is working great!

However, I am trying to configure another notification based on the input of one of the variables within the record producer i.e -

If variable 'Team Leader' is 'Joe Bloggs' then send this email notification to 'Joe Bloggs'.

Everything I have tried so far is not sending one.

Does anyone have any ideas on how to achieve this?

Thank you,
Alex

 

 

11 REPLIES 11

Community Alums
Not applicable

Hi Ankur,

Target table would be 'x_polo_forms_requests'.

Please advise further.

Thanks,
Alex

Hi,

update as below

1) your event and notification should be x_polo_forms_requests table

You just need to use script I shared

Ensure you use valid variable name and value for comparing

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

    // Add your code here

if(current.variables.teamLeader.name == 'Joe Bloggs'){

gs.eventQueue('event_name', current, current.variables.teamLeader.email, '');

}


})(current, previous);

Regards
Ankur

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

Community Alums
Not applicable

Hi Ankur,

The Team Leader Variable is a select box with manual entries for the Team Leader names.

Can the specific email address of the team leader be added to the script?

As due to it being a select box, I don't think the 'team_leader.email' function would work.

OR

Can it look for the 'who will receive' within the email notification?

 

I'm thinking I would have to set up a separate event, business rule and notification for each team leader?

You are currently helping me with a different approach here.

Thanks,
Alex

Hi,

As mentioned in my comment for this you will require separate event and notification etc

Regards
Ankur

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

@Alex 

Thanks for marking my response as helpful.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

Thanks!
Ankur

 

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