In continuation with my Last Post I was also supposed to put validation on Lead Qualification. The condition was very simple that if a Lead is going to get Qualified that it must pass through all the Business Process Stages defined under the Organization. In my Earlier Post I showed how to capture the current Stage for any record.
I guess with the introduction of Business-Process, this must be a common requirement that all the Steps defined under various Stages in a Business Rule must be covered. This will not only be helpful in smooth business flow but also to get the complete Analysis done.
I designed a similar Business process as followed by my client in his organization. It has a last stage defined as Close stage. Under Close Stage there was a Step named as Remarks wherein the concerned salesperson need to fill in the details about the customer experiences and expectation with the product. This was a mandatory field as on basis of this field value analysis, further Quotation were getting generated.
Now the problem with the current system is, even you mark the field in the last stage as mandatory; you can still Qualify the Lead. Actually the mandatory field is set only for the purpose of smooth Business Process flow so that the Stages couldn’t be jumped without completing the important steps under current Stage.
As we are all aware that One way to stop this was through Plugins wherein we can stop the Qualification process if conditions are not met. But now the same can be achieved through Synchronous Workflows wherein we can stop the Qualification Process if the conditions are not met by Cancelling the Workflow process itself. Since Synchronous Workflow works with real time transaction hence it can be rolled back. With this new introduced feature we can even write the custom message as reason for the Error.
I created a Synchronous Workflow on Lead After the Status gets changed.
Now I’ll mention all the conditions that needs to be fulfilled for the Lead Qualification to be successful, i.e. status changed to Qualified.
The above mentioned conditions ensures that the Lead stage should be in the Last Stage i.e. Close and the Mandatory fields should be completed too along with the Lead status as Qualified. Failing which throws the following error message and cancels the Operation.
Once Completed, we can save and publish our Workflow and check with the conditions now. Failing to all the 3 conditions populated the Error message with our Custom Message, which in turn cancels the Qualification operation.
This is one of the examples wherein we can use the Real-Time / Synchronous Workflow to achieve some functionality without writing any Plugin code.
Hope this will be Helpful.