Pass parent RITM values to child RITm

Sunil31
Tera Expert

Hello All,

 

Good day!

 

I have one requirement in which i have to trigger child RITM based upon parent RITM variable selection. I have done that through script. Now in Parent RITM, there is field caller Site ID. I have to fetch value associated with Site ID in Location table and have to set it for Child RITM's variable.

 

Can anyone help how to achieve this functionality ?

vorwerk_location is the reference variable in child RITM.

Site ID is field in parent RITM and location table.  

-----------Script starts here ----------

//current.comments = "Testing before function call.";

function triggerRITM() {
    var reqHelper = new GlideappCalculationHelper();
    reqHelper.addItemToExistingRequest(current.request, 'ChildRITM_SYSID', 1);
    reqHelper.rebalanceRequest(current.request);

    //glide child
    var grReqItem = new GlideRecord('sc_req_item');
    grReqItem.addQuery('request', current.request);
    grReqItem.addQuery('cat_item', 'ChildRITM_SYSID');
    grReqItem.query();
    if (grReqItem.next()) {
        grReqItem.variables.printer_details = 'Medium - Recommended for branch office';
        grReqItem.variables.elevator_available_at_location = 'No';
        grReqItem.comments = "Triggering RITM from parent with variables testing";
         //passing constant value for location in child SR.
         grReqItem.variables.vorwerk_location = Value_To_be_Set_From_Parent_RITM;
         grReqItem.comments = grReqItem.variables.vorwerk_location; */
        //grReqItem.comments = " Testing comments after varialbe value assiging.";
        grReqItem.update();
    }

}

triggerRITM();

 

2 REPLIES 2

Anil Lande
Kilo Patron

Hi,

Please try below:

 if (grReqItem.next()) {
        grReqItem.variables.printer_details = 'Medium - Recommended for branch office';
        grReqItem.variables.elevator_available_at_location = 'No';
        grReqItem.comments = "Triggering RITM from parent with variables testing";
         //passing constant value for location in child SR.
         grReqItem.variables.vorwerk_location = current.variables.siteID.toString();  // use current.variables.variable_name.toString()
         grReqItem.comments = grReqItem.variables.vorwerk_location; */
        //grReqItem.comments = " Testing comments after varialbe value assiging.";
        grReqItem.update();
    }

Anil Lande
Kilo Patron

Hi

You can use current.variable.varaible_name to access variables of current(Parent) RITM.

And map it to the variables of child RITM as per your requirement.