Change editable status for Parent\Child records

Hi Community,

I need to set a parent and associated child records to non-editable based on the change of a field in the parent record.

I have Diets (parent) and Diet components (Child) with an approval field for use by admins only - when a diet is approved I wish to make that particular diet un- editable.

I have tried editableif() changes on the field but it seems to make it un-editable for all records.

Any ideas?



1 Like

It’s not clear if your intention is to make the entire row un-editable or only a set of columns un-editable.

If it is the entire row, then I would suggest disabling the Edit action to prevent changes to the “approved” rows. You can do this by adding an expression into the “Only if this condition is true” property of the system generated Edit action for each table - Diets and Diet Components.

Assuming you have an [Approved?] column on the Diets row, the expression in the Diets Edit action would be:

[Approved?] <> TRUE

For Diet Components, I’ll assume that the proper Parent/Child relationship has been established and that the status still needs to be checked on the Parent record. Let’s say that the id of parent row is saved in a column named simply [Diet]. Then for the Diet Components Edit action, the expression would be:

[Diet].[Approved?] <> TRUE

If you wish to make a set of columns un-editable, then you would use the same expressions above but placed in the Editable_If property of those affected columns.

CAUTION: If you make the entire row uneditable, you will not have a way to make it editable again (in the event of mistake) UNLESS you create some backup plan for this use case, e.g. change the approved column in the datasource directly, or some such back door to correct the problem.

The same problem is true if the [Approved?] column is made uneditable.