- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2023 05:33 PM
i followed the article : https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0852249
1. Add a new custom 'Requested For' [u_requested_for] field to the 'sc_req_item' table.
2. Add a variable['requested_for'] at the item level to capture the user for whom this item is requested.
3. Create a Before insert business rule on 'sc_req_item' table to copy the value of variable ['requested_for'] to the sc_req_item.u_requested_for field using code that looks like below:
current.u_requested_for = current.variables.requested_for; // Copy the variable value to the RITM's Requested For field
from my flow designer , i have a variable name_of_user in the stashbucket, how can i use it to update the requested for field on the Request item form?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2023 10:54 PM
@chercm try changing the before insert business rule to after Insert business rule and change the code to below one.
Create a new before insert Business rule on table sc_req_item and add the following script.
(function executeRule(current, previous){
var gr = new GlideRecord('sc_request');
if(gr.get(current.request)){
gr.requested_for = current.variables.name_of_user;
gr.update();
}
})(current, previous)
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2023 11:12 PM
@AnveshKumar M worked thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 04:19 PM
@AnveshKumar M i believe after the change at the Catalog item for the name_of_user to Sys_id , the resultant SCTAsk form for u_requestor, it is showing blank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 06:36 PM
@chercm Change your field type to Reference to sys_user instead of String type.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2023 05:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2023 05:45 AM - edited 10-11-2023 05:55 AM
@AnveshKumar M i recreated the field and reference to the sys_user table but still i am getting a blank field and i also tried to create a before business rule copy the variable to the field and it is still showing blank . need this field to be populated with the requestor name as the report need it