how to update Requested for and Opened by on sc_req_item table

Ram050670
Tera Guru

Hi All,

how to update Requested for and Opened by on sc_req_item table in workflow of a catalog item

var requestedFor = current.varaibles.req_for;

var openedby = current.opened_by;

above are the values from current RITM and need to update on the new RITM after this request

 

var reqItem = new GlideRecord('sc_req_item');
reqItem.get(sys_id);
reqItem.requested_for = requestedFor;
reqItem.opened_by = openedby;
reqItem.update();

 

i am trying to use this but not able to update the record.

 

 

 

11 REPLIES 11

Anand Kumar P
Giga Patron
Giga Patron

Hi @Ram050670 ,

 

    var sys_id = current.sys_id;
    var requestedForSysID = current.variables.requested_for.toString(); 
    var openedBySysID = current.opened_by.toString();
    var reqItem = new GlideRecord('sc_req_item');
    if (reqItem.get(sys_id)) {
        reqItem.requested_for = requestedForSysID;
        reqItem.opened_by = openedBySysID;
        reqItem.update();
    }

 

Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Anand

Naneen_0-1698772281287.png

its still empty

if i try to use this //Update Req for on RITM
var reqRecord = new GlideRecord('sc_request');
reqRecord.get(rc.sys_id);
reqRecord.requested_for = requestedFor;
reqRecord.opened_by = openedby;
reqRecord.update();

 

then its updating sc request  req for and opened by also RITM req for but not the opened by.

@Ram050670 

 

Please review the list layout of the table displayed in the screenshot. The RITM (Requested Item) contains references to the associated request. The fields presented in the list are dot-walked from the Request table. This means that the information displayed in the list is obtained by referencing and extracting data from the Request table to provide a comprehensive view of the associated requests.

 

I hope you understand my point, please check the list view you will get some more clearity

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.