Current.variables.<variable name> not working in my catalog item's workflow

Shant Cancik
Tera Contributor

My workflow has an "Approval User" activity with a script that uses a Gliderecord to filter a table

Here is my code:

var target = new GlideRecord ('u_application_table);
target.addQuery('name', current.variables.what_app_name);
target.addQuery('u_permissions', current.variables.what_permissions);
target.query();

I'm trying to use current.variables.<variable name> in lines 2 and 3 to pull the values of the variables what_app_name and what_permissions. If I replace them with a string like 'hello' I do get results but doing it the way I do above gets me nothing. Am I doing something wrong? These variables are lookup select boxes that reference two columns in my application_table table. I'm wondering if the fact that they are references is whats messing something up.

19 REPLIES 19

I also ran this in a background script and got the correct value for my variable.



var gr = new GlideRecord('sc_req_item');



gr.addQuery('number','<MY RITM #>')



gr.query();



while(gr.next()){



gs.print(gr.variables.<MY VARIABLE NAME>);



}


i am able to get the result when i do this on sc_req_item level.


that's coming in my log


sys_request or sc_request? it's sc_request


sc_request yes. So I resolved my problem by switching my workflow to the sc_req_item table. Now when I run current.variables.<myvariablename> I do sucessfully return the value!



Now I have a new problem because even though the workflow for the RITM is running, it isn't being run unless the Request is approved and that doesn't automatically happen anymore for some reason. I have to manually approve it at the request level for the workflow to trigger at the RITM level. This functionality broke when I switched my workflow's table from sc_request to sc_req_item


does the request have any workflow at all running??



we have one workflow that runs on the request.. this checks to see if managers approval is required <we trigger this with a variable on the items> and if not marks it approved.



if you do have a workflow running on the sc_request table check it and make sure it triggered... you may have an exception for this item on it.



do you run all of your item workflows on the sc_request table? or just this one?