Requested for not populated in catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 04:15 AM - edited 07-15-2024 04:15 AM
We have catalog item that doesn't have 'requested_for' (default one referring to user table), but another one with same name and its a choice (user or group).
Now, In the Request,RITM and SCTASK, the requested for is not populating on submitting Request. How can I fix this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 05:25 AM
Hi @Anna_Servicenow ,
Try dong this from the REQ through a before Business Rule. I have detailed the business rule below:
Name: Populate Requested for Field
Table: Request [sc_request]
Active: true
When: before
Insert: true
Condition: [leave blank]
Script:
var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('request', current.sys_id);
grRITM.query();
while (grRITM.next()) {
if (!JSUtil.nil(grRITM.variables.open_for)) {
current.requested_for = grRITM.variables.open_for;
}
}
If my response helped please mark it correct and close the thread
Chiranjeevi
ServiceNow Developer | | ITSM | | ServiceNow Discovery | | Event Management | | Service Mapping | | CMDB
Please mark as Correct Answer/Helpful, if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2024 05:39 AM
Hi @Anna_Servicenow ,
By default once the request is raised you will get Requested for and opened by with the user who raised the request but still if you want to show Requested for in the variable section You can create a reference type field and reference it to User table and create a onload client script and get the current logged in user and set the value to new field and if you dont want user to change it while raising request make it as read only
Field:
Catalog client script:
Result:
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang