Populate 'Requester For' in RITM Record

chatsaurav19
Tera Contributor

Hi All,

 

Any idea how to populate the 'Requester_For' field from the Catalog Item variable in RITM record?

 

chatsaurav19_0-1692266560371.png

Thanks and Regards,

Saurabh Chatterjee

2 REPLIES 2

manjusha_
Kilo Sage

@chatsaurav19 

 

Create a before insert business rule to update requester 

current.requested_for = current.variables.variable_name_requested_for;

 

Thanks,

Manjusha Bangale

Karthiga S
Kilo Sage

Hi @chatsaurav19 


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