Skip to content

Conversation

@bhavyaa30
Copy link
Contributor

@bhavyaa30 bhavyaa30 commented Oct 5, 2025

PR Description: This PR introduces a server-side Business Rule on the Incident table that prevents users from submitting or updating records when certain combinations of field values are logically inconsistent.

For example, it blocks the submission of incidents where Impact = Low and Priority = High, ensuring logical and process-consistent data is stored in the system.
Implementation Details
Business Rule Name: Prevent Invalid Field Combinations
Table: incident
When: Before
Insert: ✅ Checked
Update: ✅ Checked
Advanced: ✅ Checked
Execution Type: Synchronous (runs on server before the record is saved)

Pull Request Checklist

Overview

  • I have read and understood the CONTRIBUTING.md guidelines
  • My pull request has a descriptive title that accurately reflects the changes
  • I've included only files relevant to the changes described in the PR title and description
  • I've created a new branch in my forked repository for this contribution

Code Quality

  • My code is relevant to ServiceNow developers
  • My code snippets expand meaningfully on official ServiceNow documentation (if applicable)
  • I've disclosed use of ES2021 features (if applicable)
  • I've tested my code snippets in a ServiceNow environment (where possible)

Repository Structure Compliance

  • I've placed my code snippet(s) in one of the required top-level categories:
    • Core ServiceNow APIs/
    • Server-Side Components/
    • Client-Side Components/
    • Modern Development/
    • Integration/
    • Specialized Areas/
  • I've used appropriate sub-categories within the top-level categories
  • Each code snippet has its own folder with a descriptive name

Documentation

  • I've included a README.md file for each code snippet
  • The README.md includes:
    • Description of the code snippet functionality
    • Usage instructions or examples
    • Any prerequisites or dependencies
    • (Optional) Screenshots or diagrams if helpful

Restrictions

  • My PR does not include XML exports of ServiceNow records
  • My PR does not contain sensitive information (passwords, API keys, tokens)
  • My PR does not include changes that fall outside the described scope

@am-shakeel am-shakeel self-assigned this Oct 5, 2025
@am-shakeel
Copy link
Contributor

@bhavyaa30 - Description is Missing, Please add

@bhavyaa30
Copy link
Contributor Author

@bhavyaa30 - Description is Missing, Please add

sure

@bhavyaa30
Copy link
Contributor Author

@am-shakeel I have added the description please have a look.

Copy link
Contributor

@am-shakeel am-shakeel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you Please add few more above Business Rule Type & all

@bhavyaa30
Copy link
Contributor Author

Can you Please add few more above Business Rule Type & all

Should I update in readme file or in PR description?

@am-shakeel
Copy link
Contributor

Both please

@bhavyaa30
Copy link
Contributor Author

Both please

Updated!

@bhavyaa30 bhavyaa30 requested a review from am-shakeel October 5, 2025 13:23
@am-shakeel
Copy link
Contributor

Just a quick note — we can actually achieve the same validation without script logic. If you define the condition directly in the Conditions tab and then use Set Abort Action in the Actions tab, it will block the record from saving just as effectively.
This approach keeps the Business Rule cleaner and easier to maintain. Let me know if you're open to updating it that way!

@bhavyaa30
Copy link
Contributor Author

Just a quick note — we can actually achieve the same validation without script logic. If you define the condition directly in the Conditions tab and then use Set Abort Action in the Actions tab, it will block the record from saving just as effectively. This approach keeps the Business Rule cleaner and easier to maintain. Let me know if you're open to updating it that way!

Thanks for the feedback! I initially used a script so we could easily extend it with more complex validation logic in the future. That said, for this simple combination, using the Conditions and Actions tabs is a cleaner approach. I can update the Business Rule accordingly.

Copy link
Contributor

@am-shakeel am-shakeel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for the submission! While the initial idea is valid, the current implementation is quite minimal and doesn’t introduce enough unique script logic or scenarios beyond what’s already covered in the repo. Since similar patterns already exist and this doesn’t add much new value, Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.

@am-shakeel am-shakeel closed this Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants