Help setting request short description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 11:36 AM
Hi everyone,
I have a requirement to set the order guide request short description to include the variable answer of request_name. Currently the short description is showing the catalog item name instead. Attached is the code of the br I am using.
thanks in advance for any insight you can provide
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 08:47 AM
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 01:23 PM
@Gemma4- I would suggest run the BR in sc_task table. Before Insert rule. And in filter conditions on when to run select your catalog item name. You may have to go through show related fields to get to your item name. It should look like Request item.item is name of your catalog item.
Then in advanced, script as follows
(function executeRule(current, previous /*null when async*/) {
var type = current.request_item.variables.request_name.getDisplayValue();
current.short_description = type;
})(current, previous);
If you want to populate the same short description to your RITM, then you just have to do a Glide query. Add this additional code below this line current.short_description = type;
var gr=new GlideRecord('sc_req_item');
gr.addQuery('number',current.request_item.getDisplayValue());
gr.query();
if(gr.next()){
gr.setValue('short_description', type);
}
Hope above helps.