Populate Service Request fields with entries on the requested item

AEC
Tera Contributor

Is it possible to populate a new service request with answers recorded on the associated requested item form?

 My customer would like data from the RITM record to automatically populate the "Short description" and "Description" fields of the Request record  .  I was not sure if this is possible?  Any suggesitons much appreciated 

5 REPLIES 5

Pau Besalu
Tera Guru

You can do it in two ways:

1. You can use Business Rule on sc_req_item table and update the REQ with the data from the RITM.

2. Use Catalog client Script onSubmit() and when the user submits the RITM, use GlideAJAX to change the fields of the REQ record.

AEC
Tera Contributor

thanks Pau, I will take a look 

best regards

Alison

Community Alums
Not applicable

Hi @AEC,

To automatically populate the "Short description" and "Description" fields on the Request record from the associated Requested Item (RITM) form, you can create an asynchronous Business Rule with the following details:

  • Name: "Auto populate service request fields"
  • Table: Requested Item [sc_req_item]

  • Active: True (checked)

  • Advanced: True (checked)

  • Set "When to Run":

    • When: Async

    • Order: 100

    • Insert: True (checked)

    • Filter Conditions: Item > is > {Select the Catalog Item where you want to apply this br}
  • In Script (Advanced Tab), add the following script:

(function executeRule(current, previous /*null when async*/ ) {

    const VARIABLE_DESCRIBEYOURREQUEST = "8a698ecc8378b2104a38b8a6feaad3bb"; // the variable sys_id

    var requestGR = current.request.getRefRecord();
    requestGR.short_description = current.variables[VARIABLE_DESCRIBEYOURREQUEST];
    requestGR.update();

})(current, previous);

Its better to save the constants on a separate script include. Its a best practice, not to hardcode sys_id on business rule.

 

Business Rule: 

MIftikhar_0-1760956013058.pngMIftikhar_1-1760956029055.png

Request and Requested Item:

MIftikhar_2-1760956191119.png
MIftikhar_3-1760956224165.png
MIftikhar_5-1760956256600.png

 

If my response helped, please mark it as the accepted solution so others can benefit as well.

 

Hi Muhammad, thanks so much for all the detail, I will give it a go and will certainly let you know how it goes,

best regards

Alison