- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2015 06:58 AM
We currently use an order guide that our users use to order computer hardware requests and on the form they choose if it's for a cost centre or project. The Cost Centre and Project fields are reference field variables to their respective tables.
Our hardware provisioner's prefer to work these requests at the Request level (REQ) instead of the catalog task and they'd like to see more information on the Request form. I'm trying to set the short_description field to 'Computer Equipment Request for [Cost Centre or Project] name' depending on what they chose on the form but in the Service Catalog Request workflow it doesn't seem like it sees the variables and gives an undefined for it (e.g. 'Computer Equipment Request for undefined'). The code below is what I'm using to try to set the short_description. Does anyone know why this is happening? Also, is it possible to show these fields on the Request form layout?
current.short_description = "Computer Equipment Request" + " for " + current.variables.project.u_project_number;
current.short_description = "Computer Equipment Request" + " for " + current.variables.cost_centre.u_name;
Thanks,
Aryanos
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2015 06:45 AM
Hi Aryanos,
You can't dot-walk that way when setting a field value, you'll have to use a gliderecord:
var req = new GlideRecord('sc_request');
if (req.get(current.request)) {
if(current.variables.project_choice == 'Project'){
req.short_description = "Computer Equipment for " + current.variables.project.u_project_number;
}
else{
req.short_description = "Computer Equipment for " + current.variables.cost_centre.u_name;
}
req.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2015 07:26 AM
Those variables actually live on the requested item, so it's a little more difficult to get their values. You could continue to run your code on the request, but you would have to do a gliderecord query and iterate through the related requested items in order to copy their variables.
The other option would be to run some code on the requested item and copy it up to the request. You will have to allow for more than one requested item being in the request, though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2015 08:30 AM
Thanks Brad, it seems like it may be more complicated than I thought. Our users can order computer equipment along with other services or no computer equipment at all so you're saying I have to look at each requested item and see if they have the variables project or cost_centre?
I'm not sure what code would be needed for the second option but which option would you think be best to do? Thanks for taking the time to respond to this post.
Thanks,
Aryanos

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2015 09:12 AM
Are you sure you're wanting to put all of the data at the REQ level or are you wanting to put it at the RITM level rather than the task level?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2015 10:40 AM
Our provisioner's would like to have all the details at the REQ level if possible so they don't have to go into the RITM's. This only would apply to computer equipment orders from that order guide. Our other services and requests work at the task level.