
- 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-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-10-2018 05:54 AM
This looks promising. It will be towards the end of the week when I can look at this closely based on the work remaining in the current sprint. I appreciate the response Brent and will look at doing this and getting back to you. - Marked the comment helpful for now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2018 11:24 AM
No worries Casey, let me know if you run into any troubles.
Brent

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2018 10:07 AM
Hey Brent,
Thanks for being patient. I was receiving an error on the Catalog task and failing to create the SCTASK. The flavor also returned undefined. This is when I learned case matters ;). 'Flavor'instead of 'flavor'
Thanks so much for your support!
If interested, I posted another question here that I would like your thoughts on - both the career advice and if you want to take a stab at my second part.
https://community.servicenow.com/community?id=community_question&sys_id=df8c13c4db2ee340107d5583ca961930