- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 10:41 AM
I would like a true/false field on the requested item table to be auto-ticked (true) depending on who the requestor is (opened by field).
We have 5 users who are classed as 'external' users, and so when they submit a request, we would like this box to be auto-ticked.
I am not very good at scripting and I am new to ServiceNow developing, so any help would be very appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 11:44 AM
Hi,
Business rule running on Requested Item table
Script:
(function executeRule(current, previous /*null when async*/) {
var caller = current.opened_by;
var externalUsers = ['c6445481eb310100fcfb858ad106fef1', '61b07c8973200010c2e7660c4cf6a7d0'];
for(i = 0; i < externalUsers.length; i++){
if(caller == externalUsers[i]){
current.u_checkbox = true;
}
}
})(current, previous);
- Just add the 5 users sys id's into that script and replace the two that are currently in there.
- Change 'u_checkbox' to the name of your true/false field
Hope this helps.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 11:39 AM
Try using a simple business rule on insert where your condition builder can evaluate the opened_by is external and the action is set the request true/false field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2022 11:44 AM
Hi,
Business rule running on Requested Item table
Script:
(function executeRule(current, previous /*null when async*/) {
var caller = current.opened_by;
var externalUsers = ['c6445481eb310100fcfb858ad106fef1', '61b07c8973200010c2e7660c4cf6a7d0'];
for(i = 0; i < externalUsers.length; i++){
if(caller == externalUsers[i]){
current.u_checkbox = true;
}
}
})(current, previous);
- Just add the 5 users sys id's into that script and replace the two that are currently in there.
- Change 'u_checkbox' to the name of your true/false field
Hope this helps.
Please mark my answer as Correct/Helpful based on impact
Regards,
Dan H
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 03:42 AM
Thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2022 04:32 AM
Hello Abbie
If that users are static ,Instead of following a script approach you can follow no script which can help on your Instance health
Build Below Condition
Opened by is "User Name 1"
AND
Opened by is "User Name 1"
AND
......
Go to Action Tabs
Select Checkbox name and set as True
Please mark my Answers Helpful if it helps in resolving your Query
Thanks
Hemant Kumar Ch