Dialogs are the new feature addition to CRM 2011.
Just like we had the ability to extend CRM using plugins and workflows, we now have the option of Dialogs as well.
What is different in Dialog?
Dialog runs synchronously like the Plugins but they have the option of providing user interface to accept custom information required for processing.
I took an example of a situation where, you want to add custom logic that will do the following if the user tries to make an Account inactive.
- Check if it has a parent account associated with it, if so let the user know about it
- Confirm if they want to de-activate the parent account as well.
- If yes go ahead and de-activate it
- Check if the account has Child accounts associated with it, if so let the user know
- Disable the Child accounts as well if the users wants.
Dialogs let you design a wizard like user interface for user input. In this example we have tried to use all the features that the dialog offers. The aim here is to demonstrate the various features of Dialogs.
Check if it has a parent account associated with it, if so let the user know about it
Here we shall make you of the Page feature that has been added within dialogs. We shall design a user interface that will ask the user the question and get the Yes/No response back.
This page is then called from the Dialog as the next step
We can check the user response to our question in the earlier step and based on that proceed further. Here we have called another Child workflow that is designed to de-activate the account passed to it. The parameter can be passed by selecting the attribute of the Account entity on which the workflow needs to be executed.
We need to design a query that will let you search for child accounts.
Here is the trick to designing a parameterized query. When designing the query, user the like condition and specify a dummy name in the query as shown below
This will now search for accounts where parent account = current account.
To see if the query returned results, use the following condition
The dialogs do not allow us to loop through the query results and perform action on each of the record found. But it supports calling of Workflows. So the last step is performed by making a call to a workflow assembly.