Entity scoped Business Rules run on both client and server side. On the server side, Business Rules are executed synchronously when a record is saved (created or updated) and this means that in some cases, Business Rules can replace synchronous Plug-ins. Business Rules UX is better and maintenance wise, implementing business logic using the declarative Business Rule is preferred over Plug-in custom code.
Sounds great, but for some Business Rule actions the meaning of running on the server side is a bit obscure:
- Show error message: on client side, the save operation is prevented by the error message. Is the save operation also blocked on the server side? Does the caller receive the designated error message?
- Set business required: does the save operation fail if a value is not supplied for the required field on server side?
- Lock or unlock field: does this action actually prevent setting field value on server side?
As for the other actions, I assume the Set visibility action is meaningless on server side and also that Set field/default value actions work on both client and server side in the same manner.
To test these three actions on the server side, I created and updated an Account record via the OrganizationService API in a synchronous manner while activating only the relevant Business Rule. Following are the various tests and results:
- Show error message
Business Rule definition:Client side test:
Server side test result: Account record is not created, the caller receives the designated error message
- Set business required:
Business Rule definition:
Client side test:
Server side test result: Account record can not be created without specifying a value for required field
- Lock or unlock field
Business Rule definition:
Client side test:
Server side test result: Account record is created successfully although the Account Number field is set to be locked by the Business Rule
Conclusion: Show error message and Set business required actions perform on server side similar to a Plug-in. The Lock or unlock field action is meaningless on server side.