- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 01:49 PM
Hello developers,
I know this question has been asked several times and I researched each different way but I haven't had any luck.
The backstory is that I'm building out a catalog item and once its submitted it goes through a workflow using flow designer. However, once I get the catalog variables, I want to send an email to certain individuals once the request is created, which I have that part working. The problem is that I'm trying to get all of the catalog variables in that email. I know I can just drag and drop the data pills but instead of giving me the display values, I'm getting the sys ids. So I tried using a script to pull in the catalog variables, which technically works but it only gives me the first variable and not all of them. Is there a way to get the display value of all the catalog items dropped into the email using flow designer?
Here's a copy of my script:
Here's the context of what I'm using it for:
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 02:43 PM
Hi,
The problem with your script is that you use "return" to early, it stops the script and returns, so the rest of the script is not evaluated.
You can change your script into something like this:
var mailtext = '';
var submitter = fd_data.trigger.request_item.variables.submitter.getDisplayValue();
mailtext += 'Requested by: ' + submitter;
var emailt = fd_data.trigger.request_item.variables.email_address.getDisplayValue();
mailtext += 'Email address: ' + emailt;
//... and continue on with all the other variables
return mailtext;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 03:26 PM
Thanks OlaN for replying! That worked!
I have two more question for you.
My first question is instead of having everything appear side by side like this:
How can I make the variables appear on a separate line like this:
Requested by: Corey Harris
Email address: coreyharris
Department: Accounting Servicing
and so on?
My last question is, if I want to add verbiage to the email and say something like Summary of Requested Items and then start listing everything out, how would I accomplish that via script?
Thanks again for your help!
Best regards,
cnharris

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2022 01:23 AM
Hi, good to see.
Regarding the follow up questions
1. You can add a newline in the text by adding a line like this
mailtext += '<br>'; // add a newline to the text
2. Just add another text line at the beginning of your script, something like this
var mailtext = 'Summary of Requested Items' + '<br><br>';
var submitter = fd_data.trigger.request_item.variables.submitter.getDisplayValue();
mailtext += 'Requested by: ' + submitter;
mailtext += '<br>';
// and so on...
return mailtext;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 11:12 AM
Thanks OlaN that worked perfectly!