If you started to explore enhancements to customer service functionality that came with 2013 SP1/Spring 2014 release, you know that entitlements can be an interesting and challenging beast to deal with. For example, consider a situation when allocation type is set to number of cases and you decrease remaining terms on case resolution. Nothing in the system would stop you from creating more cases than you have remaining terms and then resolve all those cases potentially ending with this:
Some people are unfazed by negative entitlements, I personally feel that they are akin account overdraft: handy but indicate a serious problem and should be avoided like a plague. These bankrupting circumstances can be easily circumvented with a simple real-time workflow:
- Create a real-time workflow for the case entity and trigger it after the case status changes
- Set condition to verify remaining terms on the entitlement if appropriate:
- In the best tradition of the cancelled workflows, set the dynamic error message:
- Enjoy the fruit when user tries to close a case on the entitlement without any terms left: