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
if( [invoice.statecode] = 2 , 'You cannot delete this Invoice as it has a status of Paid', 'NoOp')
Did you know?
North52 TestShield allows rigorous regression testing of your Dynamics 365 system in-sprint
As well as being scheduled, or triggered from build pipelines, TestShield automated tests can be triggered manually for a quick mid-sprint regression test. This allows for quick testing of alternative ways to implement a requirement and measure the impact on existing processes.
It's quick to clone an existing test and try variations without affecting the original test set up too.