I have an action in a record type. I've set up a very simple visibility rule for it, but it behaves weirdly.
The record type has a field Canceled of type Boolean and it cannot have null values.
The visibility rule is configured to show the action only if it's not canceled.
The action is available for users in a read-only grid and in a Related Actions tab of record's overview.
There's always correct behavior in the Related Actions tab.
In the read-only grid the action is shown only if I add a check for NULL to its visibility rule.
And in that case the actions is always visible in the grid, no matter if it's canceled or not.
So it behaves like Canceled is always NULL, though there's always a value.
What might be causing this problem?
We are still on Appian 21.4 hosted in our environment, not sure if it matters.
Discussion posts and replies are publicly visible
Can you share that code snippet?
In record action, Identifier is the mandatory parameter. Check if you have passed that.
This is the visibility rule when the action becomes always visible:
This is how the action is defined in the grid together with another action:
Seems OK to me. Instead of the or() you could just write "rv!record[recordField] <> true". That would cover NULL and false.
Did you check the actual values in the DB? I made it a habit to always set all boolean fields to a defined non-null value when creating a new record.
As Aditya mentioned, you need to ensure that fv!identifier has some valid value that also resides in the record that you are using. Also, you need to ensure that the visibility you have added should return true for the specified identifier. To check it, replace the fv!identifier with a 1 and that should give you a clear idea about how this entire thing works.
all records in DB have defined values, i checked it. But in a time I created the record type that field was nullable. Later I changed it to be not nullable in DB and in CDT. I hoped that with data sync the record type would be updated. But looks like something is still wrong in the record type definition after that update. Though it's strange that the same action behaves as expected in the related actions tab
the identifier seems to be ok, as the action is shown when i just check for null in its visibility rules. I didn't make it work unfortunately. I had just to go with a workaround. I just hide canceled records from users, so that i don't need to check the Canceled field in action itself
Unknown said:rv!record[recordField] <> true
I personally traditionally prefer either the simpler, if(rv!record[recordfield], false(), true()); especially since the "<>" operator can be finnicky about value and particular data types.
Though in terms of keeping my code modern and "correct" these days i try to just use modern a!defaultValue() functionality: not(a!defaultValue(value: rv!record[recordfield], default: false()).