- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2021 05:49 AM
Does anyone know how to get the display values from a List field within an inline script in Flow Designer?
Here is the information:
- List field is on the core_company field called "u_sub_id"
- The flow runs against a catalog item that contains a reference variable (called "customer") that references [core_company]
- Within the inline script, I want to return the first entry in the List field into a variable. Since the variable references core_company, I can dot-walk to the "u_sub_id" field. However, when I print out the results of the variable to the log, it is returning "object GlideRecord".
Here are some of the things I've tried in the inline script:
// _2__update_record is updating the RITM record
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2021 06:28 AM
Hi,
how the values in the list field looks like?
So are you saying it is only returning only the 1st choice
can you share the image how many choices that list field has
As an alternative can you try this
var rec = new GlideRecord('core_company');
rec.addQuery('sys_id', fd_data._1__get_catalog_variables.customer);
rec.query();
if(rec.next()){
return rec.u_sub_id;
//OR
return rec.u_sub_id.getValue();
// OR
return rec.u_sub_id.getDisplayValue();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2021 05:02 PM
Nevermind...I figured it out. Thx.
SNOW doc is not great at explaining. However, you can follow the below steps:
1. Create your input variable first in Flow Action, save, publish.
2. Then go to the Flow Designer + new Action or/refresh, select your Action
3. The variable you created [@ bullet 1] now should show up
4. Here you can assign it (via pill or script)
5. Then your Flow Action will be able to use it.
Happy coding!