After RITM Creation how to create Standard change

Rama26
Tera Contributor

Hi All,

 

I have two catalog forms, each with its own template. Once the RITM is submitted, a Standard Change should be created based on the corresponding catalog item.

 

I tried to store the form and template sys_id in system property and used business rule. but it's not worked.

 

 

5 REPLIES 5

OlaN
Tera Sage

Hi,

This should be fairly easy done by configuring a Flow that does all the steps.

What have you done so far?

Rama26
Tera Contributor

I created 2 system properties. 1 to store catalog sys_id and 1 for template.

Catalog_id:

{"access" : "catalog sys_id"

"info" : "catalog sye_id"

}

Template id:

{

"access" : "template sys_id",

"info" : "template sys_id"

}

 

I created business as if catalog access then in template it need to pick access template id

Okay, I understood the first part, that you've created two system properties.

The second part does not make sense to me. Please elaborate.

Some pictures could also help in understanding what you're facing.

 

Have you created a Flow that triggers when submitting the Catalog item? If so, what does it do?

Please provide more context.

Rama26
Tera Contributor

Hi below script i developed

 

 
Catalog → Template Mapping
 
var catalogTemplateMap = {
    "039c516237b1300054b6a3549dbe5dfc": "88927e5d8342361082f7f496feaad338",
    "ec80c13297968d1021983d1e6253af32": "5b7359bc53231300e321ddeeff7b12f8"
};
var ritmGR = new GlideRecord('sc_req_item');
ritmGR.get('26af7e1983c2361082f7f496feaad31f');

var catalogSysId = ritmGR.cat_item.toString();
var templateSysId = catalogTemplateMap[catalogSysId];
 
var templateGR = new GlideRecord('sys_template');
if (!templateGR.get(templateSysId)) {
    gs.error('Template not found in sys_template table');
}
 
var changeGR = new GlideRecord('change_request');
changeGR.initialize();
changeGR.type = 'standard';
changeGR.applyTemplate(templateSysId);
changeGR.short_description = ritmGR.short_description;
changeGR.description = ritmGR.description;
changeGR.requested_by = ritmGR.requested_for;
changeGR.u_ritm = ritmGR.sys_id; // optional reference field
var changeSysId = changeGR.insert();