How to access the catalog item variable in script section of approval action in flow designer

Sumit35
Tera Contributor

How to access the catalog item variable in script section of approval action in flow designer

find_real_file.png

11 REPLIES 11

Hi Sumit,

what you want to achieve by printing?

Can you explain that

Regards
Ankur

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

Hi Sumit,

you can use this and then below script should get the value in logs

1) Include this Action "Get Catalog Variables"

2) script below

/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/

var val = fd_data._1__get_catalog_variables.date;
gs.info('Variable value is: ' + val);

find_real_file.png

find_real_file.png

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

@Sumit 

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

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

Hello Ankur,

Thank you for the update above. I was trying to do the same to update short description of a catalog task when it is created but unfortunately it kept on returning [object gliderecord] 

I did update the script as below and it worked fine. I was trying to update the short description with the requested for value.

var val = fd_data.trigger.request_item.variables.<put your catalog variable name here>.getDisplayValue();
var shortDesc = "Create Account(s) for "+val ;
return shortDesc;

Thanks,

Gopi

Hi Sumit,

 

I have number in the field and I tried to return the field using just return statement below and I got the desired result.

return fd_data.trigger.request_item.variables.type_in_the_text

 

find_real_file.png

 

Kindly mark my response correct and helpful if my suggestion resolved your query,

 

Thanks

Murali