- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 08:10 AM
Hello so we have an email that is being sent to the user(s) in the requested_for and opened_by field on a request when its inserted into the sc_request table. The default behavior appears to be, when a user submits a catalog item the value for both variables is the submitting users sys_id. In our use case on the catalog item the user can pick others users I.E. if I(user A) open the catalog item I can select user B as the user. So I want to have my business rule override the value in requested_for with the user selected in the catalog item before its inserted into the sc_request table. I was able to do so with the following script but ran into a problem when trying to do the same for the RITM associated with the request. TLDR the value for requested_for in the request is now correct but the value for requested_for in the RITM is not correct. I checked in the debugger and both are getting set correctly so not sure what the issue is here.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 05:29 PM
You are setting the value of a record in another table, you will need to use .update() for your changes to be reflected.
ritm.setValue('requested_for', ritm.variables.user);
ritm.update();
I assume it works for the sc_request currently because your Business Rule is running onBefore, which means you don't need to use .update for current.setValue().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 05:29 PM
You are setting the value of a record in another table, you will need to use .update() for your changes to be reflected.
ritm.setValue('requested_for', ritm.variables.user);
ritm.update();
I assume it works for the sc_request currently because your Business Rule is running onBefore, which means you don't need to use .update for current.setValue().