Prevent Data Policy to Run on Insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 02:14 PM
Hey guys,
Recently I got a request that we should replicate the behavior that the fields have in a record view (mandatory and read only rules) in the list view. This is why I went for data policies. I have never worked before with them, but reading a little bit, didn't look like a problem.
So, I started converting my UI policies to data policies. When I went to use my record producer over that table, and it failed. Couldn't create a record. One of my UI policies had no conditions (meaning that it is always true), and over there I had some read only fields. With the UI policy I had no problem, I just didn't update those fields from the UI. The thing is that with the data policy, I would need to bypass that on insert.
My question is, can I bypass on insert the data policy? I couldn't find in the conditions a way to do that. The other option I thought was that I could set those field as RO with ACLs. Would that be the best practices way? Am I not seeing another easier option?
Thanks!
Regards
Guillermo
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2017 02:36 PM
Hello Guillermo,
The difference between a data policy and a UI policy is that a data policy operates at the server level, where as a UI policy runs on the client (the browser).
They both have similar goals and are both very useful when used properly.
A UI Policy will not allow a user to save a record/form if they haven't filled out all the required fields on the form, e.g. they haven't entered some data in a "Mandatory" field and tries to save the record.
However, If you have an integration or some background functionality creating a ticket, like a record producer from the catalog creating tickets, the UI Policy has no effect at all! But a data policy will, using the exact same conditions!
Hope that helps a little.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2020 06:25 AM
Old post, but since I just did this, I thought I'd reply. To prevent a data policy from running on insert, set the condition to "Created is not empty". That way the record can be created, but once it is, the fields specified in the policy can't be altered.
Note that using a relative time condition, such as "Created is before 1 minute ago" does not seem to work for data policies. Theoretically, you should be able to make a relative condition that says created is before 0 minutes ago and inserts should still work, but the functionality seems to be broken for data policies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 11:35 AM
That technique is not working for the out of the box incident process. If you create a data policy on incident to make the assignment_group mandatory when created is not empty, you will be able to fill in the form but when you try to save you will get a data policy exception and an invalid insert.
This may work for a Read Only requirement but not for a Mandatory one.
If I helped you with your case, please click the Thumb Icon and mark as Correct.