Accessing a variable in an Assignment Rule in Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2011 09:51 AM
There's a 2 year old question on here that is similar but I'm hoping it's gotten easier since then. 🙂
I have a variable, 'Type_of_request', with values of New, Change & Remove. I need to assign based on these values. What's the best (easiest) way to do this?
Thanks!!
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2011 10:39 AM
The question is a bit broad so can you answer a few questions to narrow down the answer. Are you using this variable in a record producer or a catalog item? What type of variable is it (Multiple Choice, Select Box, ??) If it's a catalog item are you using a graphical workflow? And finally if it's a catalog item are you trying to set the assignment group or assigned to of the request, request item, or tasks?
Just to give you a general idea, if it was a catalog item with a graphical workflow and I wanted to set the requested items assignment group, you could put the following in a Run Script as the first step of the workflow.
var tor = current.variable_pool.type_of_request;
if(tor == 'New'){
current.assignment_group.setDisplayValue("Service Desk");
}
else if(tor == 'Change'){
current.assignment_group.setDisplayValue("Applications");
}
else{
current.assignment_group.setDisplayValue("Support");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2011 01:37 PM
It is a Select Box on a catalog item. We're setting the assignment group from the sc_task table using the request item. We are using graphical workflow but are trying very hard to use only a few over and over. We'd rather be able to set the group within an assignment rule, if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2011 07:18 PM
In that case you can lookup the value using a GlideRecord query with the assignment rule. I set one up on the demo site to test it and it worked but I don't know if it will still be there when you read this so I took a screenshot (attached).
Here's the script (setup for the sc_task table):
var ritm = new GlideRecord('sc_req_item');
ritm.get(current.request_item);
var tor = ritm.variable_pool.type_of_request;
if(tor == 'New'){
current.assignment_group.setDisplayValue("Database San Diego");
}
else if(tor == 'Change'){
current.assignment_group.setDisplayValue("Database");
}
else{
current.assignment_group.setDisplayValue("");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2011 08:50 AM
Perfect! Thank you Jay!!!