New to flow designer - why does fd_data.trigger.current.requested_for not work?

e_wilber
Tera Guru

I have a request item I am building where I need to set the Short Description of a catalog task. In the script editor for the Catalog Task>Short Description I have:

 

var shortDesc = "Order mobile phone for " + fd_data.trigger.current.requested_for +
': iPhone 15';
 
When I go to test this, the catalog task doesn't get created and I see an error: Cannot read property "requested_for" from null,Detail: Cannot read property "requested_for" from null.
 
The RITM does actually show requested_for as being filled out. What am I doing wrong?
2 REPLIES 2

Justin Hatfield
Tera Guru

Are you returning shortDesc in your script on the next line?

 

you could change your code to be:

return "Order mobile phone for " + fd_data.trigger.current.requested_for +
': iPhone 15';

Animesh Das2
Mega Sage

Hi @e_wilber 

 

It looks like fd_data.trigger.current.requested_for is not a string that is creating some issue in the concatenation

Can you please try with the updated code as below,

 

var shortDesc = "Order mobile phone for " + fd_data.trigger.current.getDisplayValue('requested_for') +
': iPhone 15';
return shortDesc;
 
** I used getDisplayValue() to extract the actual name of the 'requested_for' instead of sys_id. If you want sys_id to be extracted then you can do that as well by using fd_data.trigger.current.getValue('requested_for')  OR fd_data.trigger.current.requested_for.sys_id.toString()
 

If this address your question, please mark this response correct by clicking on Accept as Solution and/or Kudos.

You may mark this helpful as well if it helps you.

Thanks, 

Animesh Das