-
Notifications
You must be signed in to change notification settings - Fork 909
Smart Field Validation and Dependent Field Derivation Using getError() and setError() #2036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Smart Field Validation and Dependent Field Derivation Using getError() and setError() #2036
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, Thank you for submitting!
|
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. |
|
Hi @ravichandra1998g |
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