The CreatorCon Call for Content is officially open! Get started here.

How to get requestor name variable value in workflow?

dashap
Giga Contributor

I tried:

 

requestor = current.variables.requested_for.getDisplayValue();

and 

requestor = current.variables.requested_for.name;

 

I am not sure what the variable name is and why it is not showing up with a value.

11 REPLIES 11

 Hi,

 

Please try below code once,

 

answer=current.variables.requested_for.toString();

 

Hope this helps!

If you have any more questions, please let me know.

If I have answered your question, please mark my response as correct and helpful.

Thanks,

Sriram

 

Harsh Vardhan
Giga Patron

your workflow is running on which table ?

 

try to add log and see what are you getting in log 

 

var rName = current.variables.requested_for.getDisplayValue(); 

gs.log('requester name '+ rName);

 

Note: make sure you have mentioned correct variable name.

It should be the the request table right for RITM tickets. I am not sure where to see gs.log entries, so I used:

 

workflow.scratchpad.requestor_name = current.variables.requested_for.getDisplayValue(); 

 

This returns nil value.  Isn't the requestor name a pretty standard thing on request catalog items?  

Any cool trick to see all the variables?

if your workflow is running on request table, try with below script

 

var gr = new GlideRecord('sc_req_item');

gr.addQuery('request',current.sys_id);

gr.query();

if(gr.next()){

workflow.scratchpad.requestor_name = gr.variables.requested_for.getDisplayValue(); 

}