Is there a way I could catch the detach event of a related record? I have tried using a validate record data trigger to check for atleast one related record to be present before update but I'm still able to detach the related record. Is there a way I could stop this and throw an error?
In 188.8.131.52, it is working fine and the release is targeted on Aug 22nd 2015 as of now.
Thanks and Regards,
We can achieve this by applying 'Validate Record Data' trigger on the top of related object. Means, select related object from 'On Field Change' drop-down and provide error message in Formula editor. But, it will work for both attach and detach but not only for detach.
One more thing, right now this case is not working as expected. Issue has been raised for the same. We will let you know once that is fixed.
Find attached screen shot.
The validation record data trigger doesn't run on detach of a related record for some reason. Is that a known problem? I have tried and checked it using the rbv_api.log() function and according to the log the trigger doesn't run on detach.
The behavior that I observed and logged an issue for the same.
Note: I tried it in 3.1 release build
-> Create couple of objects. (Ex: Obj1 and Obj2)
-> Create any relationship between them (Ex: M to M)
-> Create few records in both objects and link in between them.
-> Go to any object definition (Ex: Obj1) and create a validation record data trigger where select related object from 'On Field Change' drop-down list and provide error message and select any timing option (Ex: Before Delete) and save it.
-> Go to Obj1's record edit page and click save button without modifying anything.
-> Observe that validate record data trigger got executed ant it is throwing error that we specified.
-> It should not execute the trigger as we haven't attach/detach the related record. It should execute the trigger only when attach/detach the related record.
Hope this helps.
Ok we are using version 184.108.40.206. Can you try and do the same on the view page where we can detach an existing related record and check whether the trigger is firing? I have tried the above mentioned steps with a timing of "Before Update" on that validation trigger but it doesn't seem to run when I detach the related record. Am I missing something?
You are correct. The validate record data trigger on the top of look up field is not working in record details page.
I have added this case as well to the issue.
Could you possibly tell me as to when can I expect a fix for this please?
It is targeted for v220.127.116.11 release.
The tentative release date is 18th April 2015
Just coming back to my post as I am facing this issue again. May I know if this issue would be fixed in 18.104.22.168 release or would it be fixed in a later version? Kindly let me know.