How to create variable under under RITM

jui
Tera Contributor

Hi All,

 I have custom table in witch there are 2 approvals once 2nd approval approved after that 2 ritm ticket has been created witch is working fine now I want that in that particular RITM and sc_task table variable should come witch is not coming kindly let me know how to populated that. Varibles like.. contact type,short description,description, Requested_for etc.. when I have create ticket from service portal at that time thar variables are coming. 

 

jui_0-1747807619168.png

 

  

4 REPLIES 4

Arun_Manoj
Mega Sage

Hi @jui ,

 

Are you using workflow/flow designer?

 

jui
Tera Contributor

Hi Arunm,

 

I am using Flow designer.

 

Ankur Bawiskar
Tera Patron
Tera Patron

@jui 

how are you creating the 2nd RITM?

are you using Cart API or Flow designer?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

By using below business rule RITM created 

Condition  is approval VALUE CHANGES TO 2

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

    // Add your code here
    //if (current.approval == 'approved' && current.approval_count == 2) {

    // Function to create a ticket

    var ga = new GlideRecord('sc_request');
    ga.initialize();
    ga.requested_for = current.requestor_name;
    ga.opened_by = current.requestor_name;
    //ga.cat_item = '9cbc3394db447b00b1fb9e04db9619ed';
    var parentSys = ga.insert();

    var grRITM = new GlideRecord('sc_req_item');
    grRITM.initialize();
    grRITM.opened_by = current.opened_by;
    grRITM.request = parentSys;
    grRITM.cat_item = '9cbc3394db447b00b1fb9e04db9619ed';// FICO
    //grRITM.insert();

    grRITM.variables.sb_description = 'test';
    grRITM.variables.type_of_service='payble';
    grRITM.insert();

    var ga2 = new GlideRecord('sc_request');
        ga2.initialize();
        ga2.requested_for = current.requestor_name;
        ga2.opened_by = current.requestor_name;
        var parentSys2 = ga2.insert();

        var grRITM2 = new GlideRecord('sc_req_item');
        grRITM2.initialize();
        grRITM2.opened_by = current.opened_by;
        grRITM2.request = parentSys2;
        grRITM2.cat_item = '14a0455ddbdd2054eeb8026dd39619db';  // Ivalua sys_id
        grRITM2.insert();

       
       
})(current, previous);