We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Email notification when Record producer submitted.

eparisujitk
Tera Contributor

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.

1 ACCEPTED SOLUTION

@eparisujitk 

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! 🙏

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

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron

@eparisujitk 

no issue

-> you can create after insert BR on the target table of that record producer

-> in that BR script check the value of that variable

-> use gs.eventQueue() to trigger event and include the recipients and include in event parm1

-> in notification ensure Event parm1 contains recipients is marked as True

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Those variable i want to use are coming from variable set of record produce , i can access them using producer.varaible_name ?

Hi @eparisujitk ,

 

yes, you can!

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

@eparisujitk 

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! 🙏

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