I was wondering what behavior should be expected from unique field combination trigger, in the case one of the fields is empty.
Basically, I am using this trigger to check the uniqueness of two fields A and B combination. A is lookup field from a hierarchy relationship, so it is the parent record of the current one, and B is an integer.
I am having some strange behavior when the field A is empty (no parent), ie: sometimes it works, sometimes not !
Can you clarify me on this ? Is this trigger supposed to do the checks normally even when one of the fields is empty ?
Hi again Yuriy,
Just checked something and this might be interesting for you to consider :
For a Top Level Record, i.e one with no parent, in the Database, the field parent is 'NULL'. And sometimes, after updating the record, it goes to 0, but not always.
We had this issue sometime back, and worked around it. But it seems that when a record is created with an "empty" field in Rollbase, it is first created with a value "NULL" in the database,
then only after updating it, it goes to "empty".
We tried to reproduce this behavior for our Hierarchy relationship, but as I said, it is 'NULL' first, then goes to '0' or stays 'NULL'.
Is that something you were aware of ? We think it has something to do with the issue we are facing now with the unique field combination trigger.
this post as spam/abuse.
Thank you for the reply.
1- Ok for the first case, but in my case, I was getting that bug without even restoring the deleted object. Let me try to reproduce it again and will give you more details hopefully.
2- Ok for this case too. I understand. Fortunately we do not have to deal with this in our case, because we are not allowing deleting an Item that has children.
For the 0 value, we could not really reproduce the scenario of obtaining 0 in the parent field.
But what we did, is attaching this item (with 0 value in the parent field) to a parent, then detaching it, and then this value went back to NULL. So this is how we fixed it. But sorry we could not go back to how we get that 0 from the beginning..
I just have another scenario to suggest, maybe this is another case of the bug:
Let's say we have two records 1 and 2. Record 1 has field combination (x,y) and Record 2 has field combination (x,z).
If I go to record 2 and update the second field from value 'z' to value 'y' , it is allowing me to do so, which shouldn't be allowed again. Now I have both Record 1 and Record 2 with the same combination (x,y).
Can you please try this case as well? And confirm what behavior it is having in this specific case please?
Only thing I can see from the trigger debug, is that the unique field combination is just not running, but it should as the timing is Before Create and Before Update.