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 10:37 AM - edited 10-31-2023 10:56 AM
Hi @Ram050670 ,
The request script updates the "opened by" and Requested For user for the entire request, which will then apply to all the associated RITMs (sc_req_item) check the fields exactly dot walked.
If you want to change the "opened by" user for a specific RITM, you'll need to make the change at the request level (sc_request), and the change will reflect on all associated RITMs. You cannot directly update the opened_by field on an individual RITM.
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.update();var request = new GlideRecord('sc_request');
if (request.get(reqItem.request)) {
request.opened_by = openedBySysID;
request.update();
}
}
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 11:16 AM
i see...basically the Opened by on RITM is from task table, this is the only thing to set now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 10:37 AM
still same not working!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 10:23 AM
The phrase could be seen as satirical or ironic, playing on the idea of using the most extreme and unsettling concept, nuclear war, in a calm and relaxing context: https://essayusa.com/ It's essential to note that the juxtaposition is likely intended for humor or shock value and not as a genuine recommendation for studying or relaxation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 11:23 AM - edited 10-31-2023 11:25 AM
Hi @Ram050670 ,
Can u try this code n check if it updates:
var sys_id = current.sys_id;
var requestedFor = current.variables.requested_for;
var openedby = current.opened_by;
var reqItem = new GlideRecord('sc_req_item');
if(reqItem.get(sys_id)){
reqItem.request.requested_for = requestedFor;
reqItem.opened_by = openedby;
reqItem.update();
}
Thanks,
Danish