Autopopulate variable value

abhisek
Tera Contributor

I am working on a requirement. Using UI Action creating a request from an Incident. Once we click on the UI Action a request will be created and incident will be cancelled. This portion is working.

There are 3 variables on the catalog item for example abc, def and xyz.

abc should be auto populated as per the incident short description, def should be auto populated as per the incident description and xyz should be auto populated as per the incident urgency. This portion is not working.

Below is the script I have written:

 

(function executeRule(current, previous /*null when async*/) {
    try {
       
        var requestGr = new GlideRecord('sc_request');
        requestGr.initialize();
         requestGr.requested_for = current.caller_id;
        // requestGr.abc = current.short_description;
        // requestGr.def= current.description;
        // requestGr.xyz= current.urgency;

        var requestID = requestGr.insert();
 
        var itemGr = new GlideRecord('sc_req_item');
        itemGr.initialize();
        itemGr.request = requestID;
        itemGr.cat_item = 'sysid of the catalog item';
        itemGr.requested_for = current.caller_id;
        var itemID = itemGr.insert();

        // Update the RITM with the request summary, description, and urgency
        itemGr.abc= current.short_description;
        itemGr.def= current.description;
        itemGr.xyz= current.urgency;
        itemGr.update();

       
Can anyone please help me out, it is urgent.
     
6 REPLIES 6

Hi @HrishabhKumar 

Tried with this but not working.

Hi @HrishabhKumar 

Both the catalog item and UI action are in different application scope.