how to update Requested for and Opened by on sc_req_item table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 09:51 AM - edited 10-31-2023 09:53 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 09:57 AM - edited 10-31-2023 09:57 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 10:11 AM
its still empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 10:20 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 10:33 AM
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.