Scenario Overview
In this scenario our business requirement is that when a user tries to delete an Invoice record that has been marked as paid we would like to stop this and show an error message to the user. See the screenshot below for an example,
North52 Decision Suite Solution
The North52 Decision Suite solution works like this,
- We create a server-side only formula that fires for the Delete event of an Invoice
- The formula itself first checks to see if the Invoice has been marked as Paid
- And if true it will show the error message
North52 Decision Suite Steps
The following set of steps show you how to create this formula,
- Create a new formula of type 'Validation'
- Set the Event field to just 'Delete'
- Set the Source Entity to 'Invoice'
- Set the Source Entity Property to 'All Properties'
- Copy & paste the formula below into the formula description field
- Click Save
- You are now ready to test
Formula
if( [invoice.statecode] = 2 , 'You cannot delete this Invoice as it has a status of Paid', 'NoOp')