flow designer - Email notification action

CamUnderwood
Tera Contributor

I'm pretty new to flow designer, but old to the SN platform. 

 

looking for some insight on how some of you might go about this. I've done some reading/watching on Flow designer, but still working through it all. 

 

I've got an order guide for new hires that i'm working on notifications for, and i've got a notification that needs to go out when the order guide is submitted/REQ is submitted. I can't figure out a way to do it with traditional notifications because it doesnt want to let me dot walk up to the variables within the order guide, so i'm trying flow designer. i've tried the send email action, as well as the send notification action. 

 

for whatever reason, it doesnt want to send my variables in the notification - here's where i need help. 

Screen Shot 2023-11-01 at 6.10.53 PM.png

this results in the following:

Screen Shot 2023-11-01 at 6.10.36 PM.png

 

then i tried the send notification action, which i do like more, BUT i can't figure out how to get the order guide variables:

Screen Shot 2023-11-01 at 6.44.33 PM.png

Screen Shot 2023-11-01 at 6.45.33 PM.png

 

6 REPLIES 6

Bidduam
Tera Guru

I'd suggest keeping it in the more traditional email notification (as you've already said you'd prefer anyway), it just better practice to have all notifications going from the same spot, so maintenance and troubleshooting is easier if ever needed.

 

I do something similar as far as getting the variables and populating them into a notification and I do it via a mail script, then simply add the script in the right spot on the notification.

 

EG:

Name - add RITM variables

 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {


    var set = new GlideappVariablePoolQuestionSet();
    set.setRequestID(current.sc_req_item.sys_id);
    set.load();
    var vs = set.getFlatQuestions();
    for (var i = 0; i < vs.size(); i++) {
        if (vs.get(i).getDisplayValue() != '' && +vs.get(i).getLabel() != '') {
            template.space("\n");
            template.print("\n" + "<br>" + vs.get(i).getLabel() + ":   " + vs.get(i).getDisplayValue() + "\n" + "</br>");
        }
    }
})(current, template, email, email_action, event);

 

 

Then simply add the mail script into the body of your notification as required:

${mail_script:add RITM variables}

 

As for adding the persons name or whatever in the subject line try:

${request_item.variables.ADD YOUR VARIABLE NAME}

eg:

${request_item.variables.first_name} ${request_item.variables.last_name)

Bidduam - 

 

for whatever reason, none of the above worked. see screenshots. 

Screen Shot 2023-11-02 at 10.08.36 AM.png

this is on the sc_req_item table as you can see. should this be on the sc_req table instead?

 

i also tried your mail script and calling it into the notification, but didnt have success with that either. 

any ideas?

Screen Shot 2023-11-02 at 10.09.32 AM.png

 

Vishal Birajdar
Giga Sage

Hi @CamUnderwood 

 

I have tried with flow designer & its working for me....!!

You just don't need to add first action get catalog variables

 

VishalBirajdar_0-1698939666916.png

 

VishalBirajdar_1-1698939740035.png

 

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Vishal - 

I think we have a misunderstanding on first name. that is actually a variable from the order guide form, which is why i was gettign the variables first. here's the form. we want to pull the form variables/data over into the notification so the people getting the notification can see what was filled out in the order guide when it was submitted. 

 

any idea how to do that?

 

Screen Shot 2023-11-02 at 12.12.47 PM.png