Hopefully this question will have better success than the last....
I have table called GP. Two of the fields are called IsCurrentOption and GPPracticeId .
The GPPracticeId is a foreign key to the GPPractice table. A GPPractice also has an IsCurrentOption field.
I have a rule that if the GP record is related to a GPPractice with the IsCurrentOption = false then the GP must have IsCurrentOption = false.
I’ve created a Dynamic Root List based on the GP table. This has rules in places to deal with the scenario above and that all works well.
In my list I want to stop the user from being able to edit the IsCurrentOption field if the associated GPPractice is IsCurrentOption = false.
I created a custom Authorization rule to deal with that scenario.
When the list is loaded the rule is evaluated and the IsCurrentOption property is readonly where appropriate.
If the GPPractice is changed to a GPPractice that has IsCurrentOption = true my Authorization rule is not checked. Instead the BusinessBase will consult its cache and get the value from the last time the rule was checked. It’s not until the BusinessBase is saved (I’m assuming putting the BusinessBase through the data portal loses its cache as the caches are not serialised), will the rule be checked and return the correct result.
I couldn’t see any way of forcing my rule to be checked when the properties are changed.
Any idea’s how I can resolve this issue?
Just discovered the property on the AuthorizationRule CacheResult.
Setting base.CacheResult = false in my custom rule seems to have solved it.
Copyright (c) Marimer LLC