Help setting request short description

Gemma4
Mega Sage

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

21 REPLIES 21

@Gemma4 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

RiteshAlla
Mega Sage

@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.