What is the best way to stop a detail record from being created once the status of a field in the parent object is not a certain value. Example - Stop 'Order Line' from being created when the 'Order' status is not 'Draft'
Like
Approach 1 would be to implement this as an entity event listener. It could listen for any record save and validate, then throw an error if it's not valid (the thrown error would display for the user in the app). See https://customerfx.com/article/adding-code-to-listen-for-entity-events-in-creatio/
Approach 2 would be to implement this in the save request (assuming this is a freedom ui page). See https://customerfx.com/article/adding-code-to-the-save-event-of-a-creatio-freedom-ui-page/ The request could check the values and if not passed return false (instead of return next.handle(request)) - this approach would still allow invalid records to be added via import or processes, the first approach would not allow that.
Ryan