We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Get Lookup Select Box value in Flow Designer

ray evans
Tera Guru

Hi

 

UPDATE - I have retrieved the value using 

/var lab = fd_data.trigger.request_item.variables.allocate_asset_tag_serial_number.getDisplayValue();
return lab;
 
However, this returns the display name because that's what the variable displays - can I retrieve the asset tag in Flow designer as preference is to have the variable showing display name

 

 

 

Asset select box:

rayevans_0-1682279662424.png

Model Category

rayevans_1-1682279702042.png

 

11 REPLIES 11

Hi @AnveshKumar M 

 

This isn't returning a value

 

rayevans_0-1682348701581.png

 

@ray evans 

Use this script, as you are using it directly to update the record we should pass the GlideRecord instead of asset tag only.

 

var lab = fd_data.trigger.request_item.variables.allocate_asset_tag_serial_number;

var gr = new GlideRecord('alm_asset');

gr.addQuery('sys_id', lab);

gr.query();

var asset_tag;

if(gr.next()){

return gr;

}

return ;

Thanks,
Anvesh

@AnveshKumar M 

 

Should the last return be asset_tag? of gr? I ask because it doesn't have a value and asset_tag is defined and not used

@ray evans 

The last is to return the GR, as the update record expects GlideRecord object as it's input parameter.

 

 

Thanks,
Anvesh

Ankur Bawiskar
Tera Patron

@ray evans 

get the variable value i.e. sysId

Query the table and get the asset tag

something like this

var lab = fd_data.trigger.request_item.variables.allocate_asset_tag_serial_number;
var gr = new GlideRecord('alm_asset');
if(gr.get(lab)){
	return gr.getValue('asset_tag');
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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