- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 06:41 AM
Hi @all,
is there an easy and fast way to get the content of a Variable Set Value from a Service Catalog Item inside a workflow?
Example:
The user adds PC stuff to his cart and a mandatory field need the information who has to approve his request. The user have to specifie an approver. And then I want to create an incident which is directly assigned to this entered user/approver...
How I can do this?
Thanks
Mike
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 07:08 AM
Hi Mike,
In any workflow, you can get the value of a variable by using the notation current.variables.<variablename>. In the case of a reference variable, you'll get the sys_id of the referenced record.
To take your specific example, you can add a Create Task activity to your workflow and use the Script field in that activity to assign the task to the user referenced in the variable like this:
task.assigned_to = current.variables.<variablename>;
Where <variablename> is the name you've assigned to the reference variable.
With all of that said, I'm not sure I understand why you'd want to create an incident for a user who needs to approve a service request item. Wouldn't it make more sense to just use an Approval - User activity and assign the person in the reference variable as the approver? Using an incident to record an approval doesn't make any sense to me. The system isn't set up to support this, the approver would need a process user role (like itil) in order to resolve the incident, and you'd need to link the Incident to the Requested Item record via the Parent field. All of that sounds like a lot of work to imperfectly recreate what ServiceNow already does much better with Approval records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 06:58 AM
As per the example you specified, you would need to create the record producer that runs on incident table and in the script section(on record producer) you can specify as follows :
current.<field name on incident form> = producer.<variable name> // by this you can store the value of variable in to the specific field on the incident form.
In case of Catalog Items(i.e. on requested item table), you can store the values through the workflow.
Just after begin activity, add a run script activity and put the following snippet into it :
current.<field_name on requested item form> = current.variables.<variable_name>;
current.update();
I hope this would help .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 07:08 AM
Hi Mike,
In any workflow, you can get the value of a variable by using the notation current.variables.<variablename>. In the case of a reference variable, you'll get the sys_id of the referenced record.
To take your specific example, you can add a Create Task activity to your workflow and use the Script field in that activity to assign the task to the user referenced in the variable like this:
task.assigned_to = current.variables.<variablename>;
Where <variablename> is the name you've assigned to the reference variable.
With all of that said, I'm not sure I understand why you'd want to create an incident for a user who needs to approve a service request item. Wouldn't it make more sense to just use an Approval - User activity and assign the person in the reference variable as the approver? Using an incident to record an approval doesn't make any sense to me. The system isn't set up to support this, the approver would need a process user role (like itil) in order to resolve the incident, and you'd need to link the Incident to the Requested Item record via the Parent field. All of that sounds like a lot of work to imperfectly recreate what ServiceNow already does much better with Approval records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2016 05:48 AM
Nice reply Jim. I totally agree.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2014 11:02 AM
In catalog record producer create the approver variable ( name not question)with the element name of assigned to field of incident table. It will create the incident assigning it to the approver.