Email notification when Record producer submitted.

SujitK
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

@SujitK 

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

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