custom short description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 12:05 PM
Hi All,
I have a question, I am trying to get the task short description change based on what is selected when the from is submitted.
On the form I have two variables: a reference variable named "Application" and a select box variable named "Request". I also have the short description variable on the form. Each of the variables have the following options when selected:
Application Request
Prod Change
Test Job Edit
Dev General Support
I need to have the variables be the following when selected : Prod = PD, Test = Test, Dev = DV, Change = CH, Job Edit = JE, and General Support = GS so that in turn the
the short description on the task be changed to the following:
RITMXXXX+application+request+whatever was entered on the short description:
In other words if on the form I choose Prod and Change and have the short description "making change" then the actual wording on the short description box on the task would be: RITMXXXPDCH making change.
I thought about doing a client catalog script with the following but I am lost on how to get the rest to work as I want too. Any ideas on what is the best way to accomplish this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2017 02:21 PM
Hi,
The problem with a catalog client script is that you won't get your RITM number until the request is actually submitted. Your left with Business rule or Workflow (run script). IIn this case, I would prefer a business rule as a workflow run script would create the record with the original short des and then update while the business rule will directly set the short description to your desired result.
To make your life easier for the maping with abreviation, you could set the value of the variable as the abreviation.
Here is an example of business rule:
Table: Requested Item(sc_req_item)
When: Before
Insert: true
Filter condition:
Item is [Select your catalog item]
Script
var shortDesc = current.number + current.variables.application + current.variables.request + ' ' + current.variables.short_description;
current.short_description = shortDesc;
This script assume that your application, request and short_description fields are mandatory, otherwise you could get some undefined value in there.
If you don't put the abreviation in the value you could use a map.
var abvrMap = {
'Prod': 'PD',
'Test': 'Test',
'Dev': 'DV',
...
};
var shortDesc = current.number + abvrMap[current.variables.application] + abvrMap[current.variables.request] + ' ' + current.variables.short_description;
current.short_description = shortDesc;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2017 05:28 PM
I did the following:
Table: Requested Item(sc_req_item)
When: Before
Insert: true
Filter condition:
Item is [Select your catalog item]
- var abvrMap_app = {
- 'Prod': 'PD',
- 'Test': 'Test',
- 'Dev': 'DV',
- };
- var abvrMap_request = {
- 'Change': 'CH',
- 'Job Edit': 'JE',
- 'General Support': 'GS',
- };
- var shortDesc = current.number + abvrMap_app[current.variables.application] + abvrMap_request[current.variables.request] + ' ' + current.variables.short_description;
- current.short_description = shortDesc;
For some reason I am getting the output as RITM0030221undefinedundefined undefined
Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2017 07:03 PM
Hi, please make sure you have the right variables name (name field), in the code I've submitted I assumed the name of the variables. but clearly at least for short_description it does not seem to be the right variable name as it is undefined.
Also for the map, make sure that the attribute name (ie: Prod) is the same as your question choice value (value field, case sensitive).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2017 07:50 PM