Business Rule not triggering on Insert, but working on Update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 09:46 PM
Trying to update field on task on insertion but it is working only on update.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 10:45 PM
as per your Business rule configuration it will set that field during insert and every update
what's your requirement?
The logic will work provided the field you are dot walking fields has data in it
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 10:47 PM
Logic is not working for insert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 10:54 PM
it will only work during insert provided these fields are present an data populated in it
indicator field on form is populated?
If yes then entity field within indicator is populated?
If yes then does that entity record has name in it?
If answer to all above is Yes then it will work fine
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 11:00 PM
hi @David Boom
Remove current.update() in the Before Insert script.
you can add a check to make sure the reference field is set before trying to access entity.name, Here's an updated version of your script with a check:
if (current.indicator && current.indicator.entity) {
var gn = current.indicator.entity.name;
current.u_entity_name = gn;
} else {
gs.error("Indicator or Entity not set on the current record.");
}
If the above script still doesn't work, consider enabling debugging on your business rule and checking for any additional errors or messages in the logs to help pinpoint the issue.
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh