We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

where are workflow activity values stored?

randrews
Tera Guru

Like the title says.. where are workflow activity variables stored??

i know that for the catalog the actual values for all variables are on the Variable Ownership table.. and you can put in an item number and find them all...

i know in a background script given the right info you can reference the workflow activity variables via workflow.vars.table_varName

but what table for workflow activities are the variables actually stored on??

to be clear when i talk about workflow activity variables i am NOT talking about the item variables.. but the ones for the workflow itself...

in my specific case i want to find every approval activity in a published workflow that is a user approval where the users variable contains request.requested_for.manager

1 ACCEPTED SOLUTION

ccajohnson
Kilo Sage

You should be able to query the Values [sys_variable_value] table. I used an advanced query to find anything with requested_for in the value field:


var varObj = new GlideRecord('sys_variable_value');


var qString = 'valueLIKErequested_for';


varObj.addEncodedQuery(qString);


varObj.query();


while (varObj.next()) {


  //DO STUFF


}



Had to modify because of copy paste malformed my code.


View solution in original post

6 REPLIES 6

antin_s
ServiceNow Employee

Please check if the below helps.



Workflow tables



Hope this helps. Mark the answer as correct/helpful based on impact.



Thanks


Antin


not really... still can't get the variable values from workflows.


Juli_n
Tera Contributor

Thanks! this is very helpful 🙂

ccajohnson
Kilo Sage

You should be able to query the Values [sys_variable_value] table. I used an advanced query to find anything with requested_for in the value field:


var varObj = new GlideRecord('sys_variable_value');


var qString = 'valueLIKErequested_for';


varObj.addEncodedQuery(qString);


varObj.query();


while (varObj.next()) {


  //DO STUFF


}



Had to modify because of copy paste malformed my code.