Populate 'Requester For' in RITM Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 03:03 AM
Hi All,
Any idea how to populate the 'Requester_For' field from the Catalog Item variable in RITM record?
Thanks and Regards,
Saurabh Chatterjee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 03:21 AM
Create a before insert business rule to update requester
current.requested_for = current.variables.variable_name_requested_for;
Thanks,
Manjusha Bangale
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2023 03:24 AM
Here are the steps to populate the 'Requester_For' field from the Catalog Item variable in RITM record:
1. Create a Catalog Item with a variable of type 'Reference' to the 'User' table. Let's assume the variable name is 'requested_for_user'.
2. After the Catalog Item is submitted, a Request (REQ), Requested Item (RITM), and Catalog Task (SCTASK) records are created.
3. To populate the 'Requested For' field in the RITM record from the Catalog Item variable, you need to write a Business Rule or a Workflow.
4. If you choose to use a Business Rule, it should be an 'After' Business Rule on the 'sc_req_item' table (RITM). Here is a sample code:
(function executeRule(current, previous /*null when async*/) {
//Get the variable value
var requested_for_user = current.variables.requested_for_user;
if(requested_for_user){
//Set the 'Requested For' field
current.requested_for = requested_for_user;
}
})(current, previous);
5. If you choose to use a Workflow, it should be attached to the Catalog Item. In the Workflow, you can use the 'Update Record' activity to set the 'Requested For' field. Here is a sample setup:
- Table: 'sc_req_item'
- Filters: 'Request' is (Workflow context) 'Request', 'Catalog Item' is (Workflow context) 'Item'
- Fields: 'Requested For' is (Workflow context) 'Variables > requested_for_user'
6. Test the setup by submitting the Catalog Item and checking the 'Requested For' field in the created RITM record.
Remember to replace 'requested_for_user' with the actual name of your variable.
Please mark it Correct and Hit Like if you find this helpful!
Regards,
Karthiga