- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 10:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 10:42 PM
Data Policies are typically used to enforce data integrity by ensuring that data entered into a record meets certain conditions. However, Data Policies themselves do not directly support the inclusion of scripting (like JavaScript) in the same way that Business Rules or Client Scripts do.
Data Policies can be used in conjunction with UI Policies and Business Rules to implement additional logic, but if you need to run complex scripts as part of enforcing data conditions, you’ll need to use other mechanisms like UI Policies, Client Scripts, or Business Rules.
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 10:43 PM
Hi @Gangadhar540- ,
Unfortunately this is not possible on Data policy.
What i can recommend here is , you can try to do using business rule on the table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 10:42 PM
Data Policies are typically used to enforce data integrity by ensuring that data entered into a record meets certain conditions. However, Data Policies themselves do not directly support the inclusion of scripting (like JavaScript) in the same way that Business Rules or Client Scripts do.
Data Policies can be used in conjunction with UI Policies and Business Rules to implement additional logic, but if you need to run complex scripts as part of enforcing data conditions, you’ll need to use other mechanisms like UI Policies, Client Scripts, or Business Rules.
I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.
thank you
Rajesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 10:43 PM
Hi @Gangadhar540- ,
Unfortunately this is not possible on Data policy.
What i can recommend here is , you can try to do using business rule on the table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 10:47 PM - edited ‎01-22-2025 10:48 PM
Hello @Gangadhar540- : The Answer is No as Data Policies in ServiceNow do not support scripting directly. They are designed to enforce field-level rules (like making a field mandatory or read-only) in a declarative manner, without requiring any custom scripts.
What You Can Do with Data Policies:
- Define conditions to determine when a policy should apply.
- Specify rules for fields, such as:
- Making a field mandatory.
- Making a field read-only.
These actions are configured through the UI and do not involve writing scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2025 10:53 PM
This doesn't seem possible based on my understanding of the Data Policy.
However, you could try achieving the same result using a business rule on the table.
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************