
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2018 01:49 PM
Hey Community!
This is what I am looking to do and would like some guidance:
REQ and RITM titles to equal the value selected from multiple variables on the catalog item plus some text. Lastly, the SCTASKS to equal a value from each variable. I have a sweet example to explain.
Variable1:
Type: Select Box
Question: Do you want a chocolate or vanilla cake?
Name: Flavor
Choices: Chocolate, Vanilla
Variable2:
Type: Select Box
Question: Do you want buttercream or whipped icing?
Name: Type
Choices: Buttercream, Whipped
I want the title of the REQ and RITM to be:
Bake a (flavor) cake with (Type) icing
I want the title of the SCTASKS to be:
Bake a (flavor) cake
Make and finish with (Type) icing
So I assume the variable (Title_REQ, Title_RITM, Title_SCTASK) are Single line text (types) and setting the Default value will consist of some js.
Cheers and thanks in advance.
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2018 06:59 PM
Hi Casey,
You can achieve this in your item’s workflow. Setup a new workflow on the sc_req_item table and associate it with your catalogue item. The end result will look something like this:
Your workflow will consist of two activities. The first activity will be a run script which will set the short description (I have assumed that this is the title you are referring to) for both the RITM and REQ.
Run Script Activity:
var sd = gs.getMessage("Bake a {0} cake with {1} icing",[current.variables.flavor.getDisplayValue(), current.variables.type.getDisplayValue()]);
current.short_description = sd;
var req = new GlideRecord("sc_request");
if (req.get(current.request)) {
req.setValue("short_description", sd);
req.update();
}
The second step will be a catalog task activity. The key here is to tick the Advanced option in the Script section. In here we will place the following code:
task.short_description = gs.getMessage("Bake a {0} cake. Make and finish with {1} icing",[current.variables.flavor.getDisplayValue(), current.variables.type.getDisplayValue()]);
Now all your short descriptions should contain your personalised text. The code assumes that both of your fields (flavor and type) are mandatory and will always contain values. If they are not mandatory then you will need to add some checks to ensure you cater for when no value has been provided.
Let me know if this worked for you. Tested fine in my London developer instance.
Brent
P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 11:34 AM
No worries, glad you got it working. I've also replied to your other post. Take a look and let me know if you have any questions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 11:56 AM
If I have a universal workflow and I wanted to adapt this to catalog items using that workflow, could I complete this same objective? Would this be done using the variables or Catalog Client scripts or Catalog UI policies using a script?
If not, modifying or creating a workflow for every catalog item is not sustainable.
Today our universal workflow fits most catalog items by doing the following:
- Begin
- Tasks | Catalog Task: Task 1
- Script:
short_description = current.variables.taskshortdescription;
task.description = current.variables.taskdescription;
task.assignment_group = current.variables.agroup;
- Script:
- Conditions | If: Is there a second activity?
- Script:
answer = ifScript();
function ifScript() {
if (current.variables.secondtask == 'Yes') {
return 'yes';
}
return 'no';
}- No -> End
- Yes
- Tasks | Catalog Task: Task 2
- Script:
short_description = current.variables.taskshortdescription2;
task.description = current.variables.taskdescription2;
task.assignment_group = current.variables.agroup2;
- Script:
- Conditions | If: Is there a third activity?
- Script:
answer = ifScript();
function ifScript() {
if (current.variables.secondtask == 'Yes') {
return 'yes';
}
return 'no';
}- No -> End
- Yes
- Tasks | Catalog Task: Task 3
- Script:
short_description = current.variables.taskshortdescription3;
task.description = current.variables.taskdescription3;
task.assignment_group = current.variables.agroup3;
- Script:
- Tasks | Catalog Task: Task 3
- Script:
- Tasks | Catalog Task: Task 2
- Script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 12:00 PM
Wow that is much uglier than i typed it lol.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 12:09 PM
If I have a universal workflow and I wanted to adapt this to catalog items using that workflow, could I complete this same objective? Would this be done using the variables or Catalog Client scripts or Catalog UI policies using a script?
If not, modifying or creating a workflow for every catalog item is not sustainable.
Today our universal workflow fits most catalog items by doing the following:
- Begin
- Tasks | Catalog Task: Task 1
- Script:
short_description = current.variables.taskshortdescription;
task.description = current.variables.taskdescription;
task.assignment_group = current.variables.agroup;
- Script:
- Conditions | If: Is there a second activity?
- Script:
answer = ifScript();
function ifScript() {
if (current.variables.secondtask == 'Yes') {
return 'yes';
}
return 'no';
}- No -> End
- Yes
- Tasks | Catalog Task: Task 2
- Script:
short_description = current.variables.taskshortdescription2;
task.description = current.variables.taskdescription2;
task.assignment_group = current.variables.agroup2;
- Script:
- Tasks | Catalog Task: Task 2
- Script:
- Conditions | If: Is there a third activity?
- Script:
answer = ifScript();
function ifScript() {
if (current.variables.secondtask == 'Yes') {
return 'yes';
}
return 'no';
}- No -> End
- Yes
- Tasks | Catalog Task: Task 3
- Script:
short_description = current.variables.taskshortdescription3;
task.description = current.variables.taskdescription3;
task.assignment_group = current.variables.agroup3;
- Script:
- Tasks | Catalog Task: Task 3
- Script:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 12:11 PM
If I have a universal workflow and I wanted to adapt this to catalog items using that workflow, could I complete this same objective? Would this be done using the variables or Catalog Client scripts or Catalog UI policies using a script?
If not, modifying or creating a workflow for every catalog item is not sustainable.
Today our universal workflow fits most catalog items by doing the following:
- Begin
- Tasks | Catalog Task: Task 1
- Script:
short_description = current.variables.taskshortdescription;
task.description = current.variables.taskdescription;
task.assignment_group = current.variables.agroup;
- Script:
- Conditions | If: Is there a second activity?
- Script:
answer = ifScript();
function ifScript() {
if (current.variables.secondtask == 'Yes') {
return 'yes';
}
return 'no';
}- No -> End
- Yes
- Tasks | Catalog Task: Task 2
- Script:
short_description = current.variables.taskshortdescription2;
task.description = current.variables.taskdescription2;
task.assignment_group = current.variables.agroup2;
- Script:
- Tasks | Catalog Task: Task 2
- Script:
- Conditions | If: Is there a third activity?
- Script:
answer = ifScript();
function ifScript() {
if (current.variables.secondtask == 'Yes') {
return 'yes';
}
return 'no';
}- No -> End
- Yes
- Tasks | Catalog Task: Task 3
- Script:
short_description = current.variables.taskshortdescription3;
task.description = current.variables.taskdescription3;
task.assignment_group = current.variables.agroup3;
- Script:
- Tasks | Catalog Task: Task 3
- Script: