How can we populate 'Description & Short Description' field values from Catalog Item to the Request(sc_request) Form's Description & Short Description field?

Angshuman3
Mega Guru

Once I am creating a Catalog Item which is having a Description value 'DESCRIPTION' & Short Description value as 'SHORT', then how can the same values be auto-populated on the Request Form's Description & Short Description field

1 ACCEPTED SOLUTION

Angshuman3
Mega Guru

Hi, 

 

Thanks all for your guidance. I got a solution to this by writing this script in 'Run Script' in the workflow 

request.description = current.variables.description;
request.short_description = current.variables.short_description;

This solved the issue.

 

View solution in original post

8 REPLIES 8

SanjivMeher
Kilo Patron
Kilo Patron

You can write a business rule on Requested Item to do so. The Business rule can be async.

var req = new GlideRecord('sc_request');

req.addQuery(current.request);

req.query();

if (req.next())

{

req.short_description = current.cat_item.short_description;

req.description = current.cat_item.description;

req.update();

}


Please mark this response as correct or helpful if it assisted you with your question.

Hi Sanjiv,

What I want is I have a catalog item which has 2 fields Description & Short Description(which is visible when I click on Try It). Now, suppose I enter Sanjiv in Description field & Meher in Short Description field & click on Order Now. I will be getting the REQ no. right, now, what I want that if I click on this REQ no. and when I am redirected to the REQ Form, the Description & SHort Description should show me 'Sanjiv' & 'Meher' respectively.

Got it. You can use below script, considering your variable name in catalog item is short_description and description respectively.

 

var req = new GlideRecord('sc_request');

req.addQuery('sys_id',current.request);

req.query();

if (req.next())

{

req.short_description = current.variables.short_description;

req.description = current.variables.description;

req.update();

}


Please mark this response as correct or helpful if it assisted you with your question.

Tim Deniston
Mega Sage
Mega Sage

Keep in mind the Request is not associated to the Catalog Item except through the Request Item. The issue is that there could be multiple Request Items related to each Request, so you may have Request Items overwriting the values in the Request. The Request would end up only displaying the information for the last Request Item that was created.