How to insert fields using ACLs, Business Rules,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
How to insert fields using ACLs, Business Rules,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @karola616
In general we will not be using ACl's but we can use business rules.
Example: you can any business rule(before, after,async) when insert.
(function executeRule(current, previous /*null when async*/) {
var inc = new GlideRecord('incident');
inc.initialize();
inc.short_description = 'testing communty';
inc.description = ''test';
inc.insert();
})(current, previous);
Thanks and regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @karola616
1. Inserting Fields Using ACLs
Access Control Lists (ACLs) in ServiceNow don’t “insert” fields — they control access to them.
But if you want to control who can insert values into specific fields (i.e., who can create or update a record), you do it with table-level and field-level ACLs.
For example:
| Type | Operation | Applies to | Example |
|---|---|---|---|
| record | create | incident | Controls if a user can create a record in the incident table |
| record | write | incident.short_description | Controls if a user can set or change the short_description field |
| record | read | incident.caller_id | Controls if a user can view caller information |
Key Point:
If a user doesn’t have create permission on a field or table, they won’t be able to insert that field’s value when creating a record.
So, while ACLs don’t insert fields, they decide who can insert or modify them.
2. Inserting Fields Using Business Rules
If you mean automatically populating field values during record creation, that’s where Business Rules come in.
A Before Insert Business Rule is ideal. Example:
(function executeRule(current, previous /*null when async*/) {
// Automatically set field values before record creation
if (current.short_description.nil())
current.short_description = "Auto-created incident";
// Set a default priority
current.priority = 3;
// Set caller based on logic
var user = gs.getUserID();
current.caller_id = user;
})(current, previous);
This runs before the record is inserted, ensuring the field values are added automatically even if the user didn’t set them.
3. Typical Use Case Example
Let’s say you want to auto-populate a custom field u_ticket_source when an incident is created via email.
You’d write:
(function executeRule(current, previous) {
if (current.sys_import_set.nil() && current.sys_email.nil()) {
current.u_ticket_source = "Manual";
} else {
current.u_ticket_source = "Email";
}
})(current, previous);
This ensures that when the record is inserted, the field u_ticket_source is automatically filled without user input.
Summary
| Goal | Use This | Purpose |
|---|---|---|
| Control who can insert or update fields | ACL | Restrict or permit access |
| Automatically populate or modify fields during insert | Before Insert Business Rule | Add or adjust values programmatically |
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
sorry your requirement is not clear.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
