Conditional access permissions: Is there any way to configur

Posted by Rollbase User on 18-Apr-2012 14:27

Conditional access permissions: Is there any way to configure access permissions that are conditional on data? Here's what I want to do: I have an Employment Type object. Employee records link to employment types. Employment types are, ie, full-time or part-time. I want to allow deleting employment types if nothing has ever linked to them, and disallow deleting them if they've ever been used. This way, if you create an employment type, then realize - oh, I really don't need that - you can go ahead and delete it. I think it makes sense to just delete the thing if it's never been used. However, if it has been used, then I don't want people deleting it and breaking everything that links to it. If there were a way to specify a formula that determines access permissions, that would be perfect. I could write a formula that checks record data and returns true (allow delete) if nothing links to the record, and false otherwise (disallow delete if something links to it). Thanks!

All Replies

Posted by Admin on 18-Apr-2012 18:26

Absolutely there is a way to do this.



1. Create a trigger on your Employment Type object of type "Validate Record Data"

2. For Timing, select "Before Delete"

3. In the trigger condition formula, check if there are any related Employee records. If there are just a return a String and this trigger will prevent deletion of the Employee Type record it was invoked on, giving that String to the user as an error message. If there are no related Employee records, return null and deletion will be allowed to proceed.



Hope this helps

Posted by Admin on 18-Apr-2012 19:01

Hey Matt,



Ah, validate before delete! That should work nicely. Thanks for that.



P.S. - I'm loving the great system, and the Rollbase in Action book.



Thanks,

Nathan

This thread is closed