- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Scenario is there is a record producer , i want to send a email notification when ever the record producer submitted only when on one particular choice for a question but problem is the receivers email are based on the user input in RP , and some variable of RP i need to show in notification body and those variable are NOT MAPPED in the table. What can be done.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
why you want to use producer.variableName?
The approach I suggested is to use after insert BR and syntax to get variable value is this
current.variables.variableName
it's simple
-> create event on your table
-> create notification which triggers based on the above event
a) set event parm1 contains recipient - True
b) set your body, subject etc
-> create after insert BR which checks your variable value
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.variables.variableName == 'your choice value'){
gs.eventQueue('eventName', current, current.variables.variableNameForRecipient); // give here the variable name from where recipient should be picked
}
})(current, previous);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
I need to show some inputs answers(not mapped ) in the mail body , how can i acheive that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @SujitK
According to my understanding, Here we have two options:
1 : Create fields in table that required in notification and Map the required Record Producer variables to created fields on the target table and use those fields in the notification for conditions, recipients, and email content.
2:If mapping is not possible, trigger a custom event from the Record Producer script and pass the required variable values as event parameters. Configure the notification to fire on that event and use the event parameters for recipients and email body.
If this helps, please mark the response as Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
-> Create an Event: Go to Event Registry and create a new event rp.notification.triggered
-> Create a Business Rule: Set it to run After - Insert on the target table
Script: Check the RP variable value using current.variables.variable_name.
Trigger Event: If conditions match, fire the event using gs.eventQueue ('rp.notification.triggered', current, recipient_email, variable_data);
-> Create an Email Notification:
When to send: Set to "Event is fired" and select your event.
Who will receive: Check Event parm1 contains recipient.
Message Body (Mail Script): Since variables are not mapped, use a Notification Email Script to print them
I believe this should work. Kindly acknowledge by giving a thumps 👍🏽
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @SujitK ,
Why don't you use the record producer script to send this email(once successful record creation) , you can easily access record producer variable using Producer api and use gs.eventQueue() as @Ankur Bawiskar mentioned.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
