Send Email notification for selection of MF2 selection

JVINAY
Tera Contributor

Hi Team,

My Requirement:

If user select the " Is this in scope of MF2 initiative = Yes" , Send email notification to user , if user select the   " Is this in scope of MF2 initiative = no "  not required to send email notification.

JVINAY_0-1738674357237.png

Is there any  requests associated with MF2=YES , This notification will be sent .

There are 20 notifications are there in the system so we can add this "Is this in scope of MF2 initiative? = Yes" line to 

existing notifications if the users select to the MF2.

 

Please help me how can we achieve this.

1 ACCEPTED SOLUTION

@JVINAY 

use this

var mf2initiative = current.variables.mf2initiative.getDisplayValue();
if (mf2initiative == 'Yes') {
template.print('Yes');
} else {
template.print('No');
}
})(current, template, email, email_action, event);

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

23 REPLIES 23

@Ankur Bawiskar ,

I have written this code but not working, MF2 email not trigger. 

JVINAY_0-1738839315919.png

 

@JVINAY 

are you sure variable name is correct and variable value used to compare is correct?

I believe notification is on RITM table

Also use == and not === during comparison

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@JVINAY 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi @Ankur Bawiskar , Thank you for your response,

This code working fine for new emails .

I have one query, I want to apply notification /email script for existing notifications, this is only value change  based upon user selection yes/no should be display.

JVINAY_0-1738849188189.png

var grSD = new GlideRecord('     '); :- Which table should I select ?
and Also please help me above screenshot code modification.
Thank you for your help and suport

 

 

@JVINAY 

Glad to know that my script worked.

Please mark my response as correct and close the thread.

The discussion on your subsequent question can continue even after that.

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