- 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
‎03-02-2015 01:29 PM
My suggestion is to make a "Run Script" activity on the workflow for the RITM where you query for the REQ record related to it and then update the record from there. This is the way I do it. Since you are running the script from the RITM's workflow, you have the variables available to you.
Another option would be to do this from a Business Rule after the RITM is inserted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2015 06:40 AM
Hi William,
Thanks for suggesting another option. I added a Run Script activity and put in the following script but it doesn't seem to update the Request short description and leaves it blank. Do you know what might be causing it to do that?
if(current.variables.project_choice == 'Project'){
current.request.short_description = "Computer Equipment for " + current.variables.project.u_project_number;
}
else{
current.request.short_description = "Computer Equipment for " + current.variables.cost_centre.u_name;
}

- 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
‎03-03-2015 06:50 AM
Ah, thanks Brad. I thought I could do it the same way as I had set the Catalog Task short description. It works now, thanks a lot for all your help on this issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2015 09:17 AM
This script works great.
I needed to use a catalog variable in the short description that was of type Reference that references the Company table. My assignment line is:
req.short_description = "Create CI for " + current.variables.u_company.getDisplayValue();
If you do not use getDisplayValue(), the sys_id is returned.