Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add to Email notifications

JVINAY
Tera Contributor

Hi Team, 

My requirement is:

add to email notifications: 
Is this CIR associated with any migration factory or other enterprise tracking initiatives?
If answer is Yes to the following question(s), display:  MF2

Is this in scope of MF2 initiative? = Yes.

 

How can I achieve these, please help to achieve this requirement.

6 REPLIES 6

@JVINAY , Glide Record to the table where "mf2_initiative" field exists.

also, here's the updated code : 

var mf2initiative = [];
var grSD = new GlideRecord('table_name'); // Replace with actual table name
grSD.addQuery('sys_id', 'IN', current.mf2_initiative.toString());
grSD.query();

while (grSD.next()) {
mf2initiative.push(grSD.getValue('mf2')); 
}

if (mf2initiative.length == 0) {
template.print('None');
} else {
template.print(mf2initiative.join(',')); // Display MF2 values
}

 

Try and let me know if this works

 

Please mark reply as Helpful/Correct, if applicable. Thanks!

Hi @Priyankagupta 

Thanks for your response.

I want to fetch ths variable form the Variables ( Record producer)

 I have developed the code metioned below . Please correct me any change required.

//Fetches the Mf2 value from variables
var mf2initiative = current.variables.mf2initiative.getDisplayValue();
if (mf2initiative.length === 0) {
template.print('None');
} else {
template.print(mf2initiative.join(','));
}
})(current, template, email, email_action, event);

 

Thank you for your cooperation.