Using Variables in Workflow Activity - Set Values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2013 07:13 AM
Is it possible to use a variable like Assigned To: ${current.cmdb_ci.owned_by} with the Set Values activity in workflow? Anything I set in the box gets cleared out as it doesn't match anything from the reference field. It would be nearly as easy to do using a script, but I'm curious to know if this is possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2013 11:58 AM
You need to use a Run Script in this situation.
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 05:25 PM
Based on the specific question you're asking, it seems like you've already discovered that you can pull field values right in the Set Values Activity using the ${standard notation} (e.g., ${current.variables.variable_name} in a Requested Item workflow).
Even though it's probably buried somewhere in ServiceNow's Wiki (maybe under the lengthy Using Variables in a Workflow), I hadn't realized this until just now. It's a great replacement for the overly basic Run Script Activities I had been employing, so I'm using your rooftop to shout it from!
(That being said, you've found at least one limitation with this approach, but it's working perfectly for setting my RITM's Short Description based on a variable's value.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2015 05:50 PM
Okay, now that I'm down rejoicing over this great functionality, I have my own question: is there any way in the Catalog Task Activity to do something similar?
I've tried various combinations of ${current.variables...} and ${variables...} (with Task Value From both "Fields" and "Values"), but the only success I have is when I use the Advanced Script field.
Specifically, I'm trying to set the Short Description of a Catalog Task to be "Event Setup - ${current.variables.v_title}."
In the Advanced Script field, this works:
task.short_description = ('Event Setup - ' + current.variables.v_title);
In the Short Description field, "Event Setup - ${current.variables.v_title}" does not work. (Neither do any other various combinations I've tried.)