- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 09:28 AM
I'm somewhat new to using scripting on SN. I was playing with workflow scripting and I just can't figure out what is the difference and the proper usage between current.variables.variablename or just using current.variablename? Within the same script, in some cases, both work, and in other cases, only current.variablename work ? search the internet and can't seem to find an answer. Thanks in advance for any clarifications.
Solved! Go to Solution.
- 35,158 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 09:43 AM
Your current is the table on which the workflow is currently running.
current.variables.variablename is the right way to fetch all the variables that were declared in the catalog item and now
a part of the requested item. So generally this gets picked up from the Variable ownership table in correlation to the requested item.
current.variablename would also sometimes work if you had the same variable or in this case column name defined in the current table.
So if were to take the flow of catalog item to requested item, anything in the catalog item that you would like to refer
you would use the current.variables.variablename and anything in requested item table by itself you would use current.variablename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 09:43 AM
Your current is the table on which the workflow is currently running.
current.variables.variablename is the right way to fetch all the variables that were declared in the catalog item and now
a part of the requested item. So generally this gets picked up from the Variable ownership table in correlation to the requested item.
current.variablename would also sometimes work if you had the same variable or in this case column name defined in the current table.
So if were to take the flow of catalog item to requested item, anything in the catalog item that you would like to refer
you would use the current.variables.variablename and anything in requested item table by itself you would use current.variablename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 10:28 AM
"current" always gives access table columns. if you want to access any column on the table (for instance requested item table (sc_req_item), use
current.COL_NAME
variables which you create on catalog item are stored in a different table, in order to access variables on Requested item/Catalog Task table, use
current.variables.VARIABLE_NAME.
please refer Using Variables in a Workflow - ServiceNow Wiki for more information
Thanks,
Sai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 11:15 AM
thank you all, very helpful...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 12:09 PM
Can you make answer as Correct if it helps, so it helps other people to look in future?
Thanks,
Sai