Using Variables in Workflow Activity - Set Values

nlong
Kilo Contributor

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.

3 REPLIES 3

Michael Kaufman
Giga Guru

You need to use a Run Script in this situation.

Mike


Mike McCall
Giga Guru

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.)


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.)