Smart Field Validation and Dependent Field Derivation Using getError() and setError()#2036
Merged
ravichandra1998g merged 25 commits intoServiceNowDevProgram:mainfrom Oct 11, 2025
Conversation
If you need HTML beautified alert box, use this.
UI Page to render the custom alert
These are example ScreenShots for reference
Example Screenshots
…Info.png to Catalog Client Script/CustomAlert/Screenshots/ExampleScreenShotCustomAlertInfo.png
…ertSuccess.png to Catalog Client Script/CustomAlert/Screenshots/ExampleScreenShotForCustomAlertSuccess.png
…rtDanger.png to Catalog Client Script/CustomAlert/Screenshots/ExampleScrenShotForCustomAlertDanger.png
Notes for installation or Implementation
Business rule to add work notes on record if notes for tag entries are allowed. It is very hard to track who added the tag to the record and when, this will help to manage to understand who has added what tags on record.
Business rule to add work notes on record if notes for tag removal are allowed. It is very hard to track who removed the tag to the record and when, this will help to manage to understand who has removed what tags on record.
Notes for the implementation
This reverts commit a56fd1f.
This reverts commit deb75b1.
This reverts commit 064f919.
…tion Using getError() and setError() directory
Readme File
Validate Short Description BR
Dependent BR
ravichandra1998g
approved these changes
Oct 11, 2025
Contributor
ravichandra1998g
left a comment
There was a problem hiding this comment.
looks good, Thank you for submitting!
Contributor
|
Hello @mandeepkaran I have reverted this PR as you have created a new main folder - "GlideElement". There is already GlideElement Folder under Core ServiceNow APIs folder. please DO NOT create a new folder. use already existing - relevant folders to submit your code snippet. |
Contributor
Author
|
Hi @ravichandra1998g |
17 tasks
17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description:
Smart Field Validation and Dependent Field Derivation Using GlideElement.getError()
This contribution demonstrates how to pass validation context and error messages between multiple Business Rules using the GlideElement.setError() and GlideElement.getError() methods.
The idea helps developers avoid redundant validation logic across Business Rules while enabling context-aware field derivation.
In this example:
The first Business Rule (Order 100) validates the short_description field and sets an error message if it’s too short.
The second Business Rule (Order 200) reads the error using getError() and performs dependent logic—such as populating a category or impact field—only if no error exists.
This approach improves performance, reduces code duplication, and maintains consistent validation handling across rules.
Pull Request Checklist
Overview
Code Quality
Repository Structure Compliance
Core ServiceNow APIs/Server-Side Components/Client-Side Components/Modern Development/Integration/Specialized Areas/Documentation
Restrictions