How to get the display value of a reference field in Flow Designer script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 12:13 PM
I have created a flow for a custom task and need to add some details to the description in the task and email that is generated later. I'm using a script to get the details, however, for the reference field I can't seem to get the display value and need some help on how to get that in a script for flow designer.
Here's what I have done:
1. Created a flow variable called emailDesc
2. Added Lookup action to the flow (more than one record will be found)
3. For each item in the lookup, set the flow variables. This is where I have the script.
This is the script for the variable:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 12:36 PM
Hi,
Try something like this in your script:
// first time in the loop the variable is empty, set the first data
if (fd_data.flow_var.emaildesc == '') {
return fd_data.flow_var.emaildesc = 'Product model: ' + fd_data._3__for_each.item.model.display_name.toString() + '\n' + 'Part number: ' + fd_data._3__for_each.item.part_number;
}
// for each run after the first run, add newline and additional data
else {
return fd_data.flow_var.emaildesc += '\n\n' + 'Product model: ' + fd_data._3__for_each.item.model.display_name.toString() + '\n' + 'Part number: ' + fd_data._3__for_each.item.part_number;
}