Getting Catalog Item variable to Workflow Scratchpad.

Wesley Breshear
Tera Expert

Hello,

I have read a few ServiceNow articles and it appears you can get/pass Request Item variables to the Workflow Scratchpad OOB.  Anyway having a problem or missing why I am not getting the value to the scratchpad. 

So, on the sc_cat_item table, I created a new column called Manager Approval (u.manager.approval) [True/False].  This way on all our current catalog items a catalog admin can select if the Catalog item requires Manager Approval.  In my workflow, I have the below IF condition to look to see if the Catalog item has the 'Manager Approval' checkbox set to True or False.  But my workflow.scratchpad.u_manager_approval the variable is undefined.  Am I missing something?

answer = ifScript();
var manApp = workflow.scratchpad.u_manager_approval;
//var manApp = current.variable_pool.u_manager_approval;

gs.info('manApp Value: ' + manApp);  // returns 'undefined'

function ifScript() {
 if (manApp == true) {
 return 'yes';
 }
 return 'no';
}

gs.info('Answer Value: ' + answer); // returns 'no'

Here is an article that I referenced: 

https://community.servicenow.com/community?id=community_question&sys_id=ddc013a9dbdcdbc01dcaf3231f9619f7 

 

Thank you,

-Wesley

 
1 ACCEPTED SOLUTION

I get it now, you can do this through filter condition, doesn't require scripting, like below, to check if manager field is true then if activity will return true else it will return false.

 

find_real_file.png

 

 

find_real_file.png

 

find_real_file.png

 

View solution in original post

16 REPLIES 16

Wesley, 

I'm not sure if you have figured out your approval answer but I had the same problem where the workflow burn pass the approval. 

 

I had to get the sys_id of the user reference then set the approval answer to the sysID.   

Wesley Breshear
Tera Expert

Hi Shishir,

My bad, I assumed and should have looked that the table for the field.  Thanks!

-Wesley