Flow Designer - DisplayValue

Wasdom_Kung
Tera Guru

Hello,

Currently within any items using a flow, the short description fields are populated with text and then  data pill for a form choice such as hardware type. However, when the short description is populated, it is the value of the choice and not the display value. 

I've had a look through some of the transforms and scripts but can't see a way to get the display value to show instead - can someone tell me how to achieve this?

Thanks!

1 ACCEPTED SOLUTION

@Wasdom Kung 

I was able to get the variable choice label and set it in Task Short Description; please try this

Script for your case:

var ritmSysId = fd_data.trigger.request_item.sys_id;
var rec = new GlideRecord('sc_req_item');
rec.get(ritmSysId);
var variableDisplayValue = rec.variables.please_select_the_type_of_change_you_require.getDisplayValue();
return 'New Work Request - ServiceNow:' + variableDisplayValue;

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

can you share what script you applied

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi, 

No script for now but this is the flow below. The task pill for type of change will show the value rather than the display value which would be preferable

find_real_file.png

Hi,

in that case you will have to use script for setting that short description with the display value

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

something like this

var variableDisplayValue = fd_data.trigger.request_item.variables.please_select_the_type_of_change_you_require.getDisplayValue();

return 'Your String:' + variableDisplayValue;

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader