Is there a way to set an email as High Importance using a Mail Script?

neil_b
Tera Guru

I have one notification that gets triggered to be sent several weeks before the due date, and every subsequent week after that until the due date. 

 

There is a requirement for the fourth notification that is sent exactly the last week before the due date, to have the email sent as High Importance. 

 

Is there a way to accomplish this using a mail script? I am trying to avoid creating a second duplicate notification just to handle High Importance and would prefer to simplify things and have it handled conditionally in a mail script. 

 

This is what my mail script is now but it's not working. I think it's not working because my notification is triggered from the cmn_location table and so using current.email.importance isn't valid syntax. I'm not sure how to glide into the notification itself. 

    var gdt = new GlideDateTime().getMonthUTC();
    var today = new Date();
    var month = gdt;
    var dayOfMonth = today.getDate();
    var reminder = '';
    if (month == 1 && dayOfMonth == 1) {
        reminder = 'first';
    } else if (month == 1 && dayOfMonth == 7) {
        reminder = 'second';
    } else if (month == 1 && dayOfMonth == 15) {
        reminder = 'third';
    } else if (month == 1 && dayOfMonth == 22) {
        reminder = 'fourth';
    }

    if (reminder == 'fourth') {
        current.email.importance = 'high';
    }

 

1 ACCEPTED SOLUTION

@neil_b

then have separate notification for 4th iteration and set the Importance=High at notification level

Have a separate event for 4th iteration and link it with above email

In your script when it's 4th iteration, use this event so that the high importance notification is sent

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

8 REPLIES 8

@neil_b 

Hope you are doing good.

Did my reply answer your question?

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 assistance. Just to be clear, what you are saying is that it is impossible to flag an email as High Importance via mail script? You've only given me suggestions that is outside of my requirements that aren't related to mail scripts. 

 

The subject is the same for all iterations of the notification so the business rule suggestion couldn't be used in my case, and I would like to avoid creating multiple notifications for the same email, which is why I am trying to accomplish this using mail scripts conditionally.

@neil_b 

that's correct, not possible to set the importance using email script. I didn't find any function for that.

Try to see what all methods are available in the email script email object

try this line in email script

mail.importance = "high";

I believe the only way is to use business rule on email table and identify the 4th email with something unique

check discussion on this thread.

How Do I Set the Importance of an Email in Flow Designer? 

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 verifying that this is an impossible task. I will just create a second notification to handle High Importance. I appreciate you looking into this for me! I will mark your response as the solution.