How to access Requested Item Variables from a scoped app?

Thilo Grobe
Giga Guru

Hi all,

I've been struggling finding a solution to access variable values in a scoped app.

My scoped app contains (simplified):

  • A table "custom_item" extending the "sc_cat_item" table
  • A variable set associated with every "custom item" containing a reference variable "user" pointing to the user table
  • A basic workflow running on "sc_req_item" which accesses the variable.

When I order an item stemming from the custom_item table though the standard catalog application, the variable value is visible and accessible for users working with the item record like expected. However, a the workflow from the scoped app can only access the variable name, but no other property of the variable object.

I only get scope fencing exeptions, the variables array on the requested item contains no accessible values as well.

This is what I tried in a "run script " wf-activity:

//test1

gs.debug(JSON.stringify(current.variables)));

//test2

gs.debug(JSON.stringify(current.variables.user));

//test3

gs.debug(JSON.stringify(current.variables['user']));

//test4

gs.debug(current.variables.user.getValue());

//test5

gs.debug(JSON.stringify(current.variables.user.getGlideObject()));

//test6

gs.debug(current.variables['user'].getValue());

//test7

gs.debug(JSON.stringify(current.variables['user'].getGlideObject()));

//test8

gs.debug(JSON.stringify(workflow.getVariable('user')));

Unfortunately none of the above seems to work or give the value in a scoped app.

Is there any other way than using the REST Table API on the requested item variables to get these values from a scoped script or workflow?

I'm working on Kingston patch 1.

I really hope there is a simple way to access the values, this is driving me mad

Thank you in advance for your help!

Thilo

EDIT: Some minor code corrections in the run script example

3 REPLIES 3

dave_edgar
Mega Guru

Hi Thilo



you could set the inputs in the workflow to pickup the variables, then you can reference them and link them to scratchpad with code similar to this:



In Inputs:


mfa.JPG



In Script:


workflow.scratchpad.MFA = workflow.inputs.u_mfa;



Hope this helps


Hi Dave,



thanks for the hint, but the scoped workflow runs on the standard requested item table. afaik workflow inputs only work on global -> I don't see the Inputs tab on my workflow properties.



Is there something I'm missing here?



Cheers,


Thilo


Try this:



current.variables.user + ''



Roehl Tablada