How to display the content /value of field in email notification ?

Buddy 1
Tera Contributor

Hi,

I have included a field in email notification script and the field is displaying in the email notification.But the content or value in that field is not displaying and it is empty.

How to show the value of the field in email notification?

Thanks!

9 REPLIES 9

Sagar Pagar
Tera Patron

Hi,

Can you share the notification or email script configuration here?

 

Thanks,

Sagar Pagar

The world works with ServiceNow

 

    var emailUtils = new global.BMEmailUtils(this);
    var sourceTableDV = current.getClassDisplayValue();

    var language = current.contact.preferred_language;
    var number = current.number + '';
    var portalLink = emailUtils.getFormattedLink(emailUtils.instanceUrl + '/portal?id=ticket&sys_id=' + current.getUniqueValue() + '&table=' + current.sys_class_name, current.number);
    emailUtils.setLanguage(language);
    emailUtils.addHeader('Case');
    emailUtils.setSubject('ResolvedSubject', [number]);
    emailUtils.addTitle('ResolvedTitle');
    emailUtils.addSalutationText('Resolved', [portalLink]);
    if (current.variables.enquiry_description) {
        emailUtils.addFields(current, ['number', 'order_number', 'short_description','enquiry_description']);
    } else {
        emailUtils.addFields(current, ['number', 'order_number', 'short_description']); // The variable does not exist
    }
    
    emailUtils.addJournalField(current, 'comments', false);
    emailUtils.addFooter('Thank you');
    template.print(emailUtils.getContent());


})(current, template, email, email_action, event);

Jaspal Singh
Mega Patron
Mega Patron

Hi,

How is the notification being checked? Is it being verified by sending it to a mailbox or are you using Preview Notification button on the notification?

If latter, the ensure that you check for a valid record with all related values when you preview the notification.

Hi,

I am checking it through preview notification button on notification