Monday, November 14, 2011

CRM 2011 Dialogs with Dynamic FetchXML - Duplicate Case Detection

Dialogs are a great new addition to the CRM feature suite. They provide an efficient way to capture business process information through a logical step by step workflow. Think of a Customer Service Representative entering a case, or Marketing folks qualifying a lead. There are still ways to go with regard to using dialogs as a full fledged call center scripter, but it is definitely the right step forward for Microsoft.

In dialogs, the user responses are captured and steps can have branching based on previous responses. There is also the capability of generating dynamic questions, which we shall see in more detail in a bit. Dialogs are a bit similar to workflows in that you can do create/update actions on entities/ records. In a sense, we can think of dialogs as a workflow with user input. Dialogs can be run only on one record, and unfortunately, the response does not have a muti select option (ie, you cannot choose more than one answer as a response).

The business case is as follows. I want to be able to detect any duplicate cases (based on title and customer) related on the current case. If I do find similar ones, I want to be able to create a connection between the 2 cases using a custom connection role, mark the case found as cancelled/ duplicate and add a note to the duplicate case mentioning the reason. Remember that both the customer and title needs to be match for this duplicate detection to work.


1. Create a new solution called Case Dialog. Create a custom connection role for cases called Duplicate Case. Add Case entity to the solution. Under fields/ statuscode, add a status reason called Duplicate under Status Cancelled.

























2. Go to Components/ Processes left navigation link and select a new Process. Give a name for the process, select "case" as the entity and "Dialog" as category. Click "Ok" button to create the dialog.


























3. Under Steps, click on "Select this row and click add Step". Go to Add Step and select "Page" in drop down.




































4. Name the Page  Search Criteria. Add a prompt and response step called "Search text" for the page. Click the Set Properties button.











5. Enter prompt text as "Enter the text to search" and a value for the Tip Text. Select Response Type as Single Line, Data Type as Text and Default Value as the originating case title. Save and close the webpage.
























6. Go to Add Step and select "Query CRM Data" in drop down. Enter "Query Duplicate Cases" as name for the step. Select Set Properties button. The Define Query webpage dialog opens.

















7. Enter the following values in Query Details/ Design New tab:
Look For: Cases
Attribute Title contains "text"
Attibute Customer equals customer (select one from the lookup)
Attibute Case does not equal case (select one from the lookup)
Status equals Active

It should look like something below:




















8. We are returning all cases that contain a particular text, and are associated with a particular customer. Since we are running the dialog from a case, we do not want that case to show up in the results. In order to do that, we need to make these filters dynamic.

Select the "Modify Query Variables" tab just below the label Query Details. You will see filter conditions as variables that can be modified.
























9. Delete Variable1 value, and add a dynamic value of the response text from "Search Text" prompt (in step 4). For Customer and Case variable fields, add dynamic values from the case/ customer and case/case respectively. Select Save and Close on the webpage.

























10. Under the Query step, add a check condition step.

















11. Click on <condition> (click to configure) link. In the specify condition webpage, select the local value
"Query Duplicate Cases" (the Query name from step 6). Select Records and Greater than in the next two drop downs. Enter 0 in the text field. Save and close the webpage












12. Add a page under the condition step. Name it List of Duplicates. Under the Page List of Duplicates, create a prompt and response step and name it Case list. Click the Set Properties button for the prompt and response step.
















13. Provide the prompt text. Select Response type as Option Set(Radio Buttons). In Provide Values section, choose Query CRM data option, and select "Query Duplicate Cases" (the Query name from step 6). Check the columns you want show and enter the separator.




























14. Create a new Page called "Confirm closing duplicate case". Add a Prompt and Response under it called Cancel Case. Click the Set Properties button for the prompt and response step.




















15. Provide the prompt text. Select Response type as Option Set(Radio Buttons). In Provide Values section, choose Define Values, and create 2 values Yes and No.

























16. Add a check condition step called "Check if case marked as duplicate". Click on <condition> (click to configure) link. In the specify condition webpage, select the local value "Cancel Case" (from step 14). Select Response Label and Equals in the next two drop downs. Enter Yes in the text field. Save and close the webpage.













17. Add a Create record step under the condition step. Name it Create Connection. Select Connection from the drop down. Click the Set Properties button for the create step.








18. For case name, select the the local case selected from Case list prompt and response step (step 12). Choose "Duplicate Case", created in step 1, as the connection role. For connected from lookup, select the case that is the primary entity.



















19. Add a Create record step under the previous step. Name it Create Note for duplicate case. Select Connection from the drop down. Click the Set Properties button for the create step.











20. For regarding case name, select the the local case selected from Case list prompt and response step (step 12). Enter a title for the note.






























21. Add a Change Status step under the previous step. Choose the the local case selected from Case list prompt and response step (step 12). Change status to cancelled.













22. If you return multiple duplicates you want to run through them without starting a dialog each time. Create a Link Child Dialog Step under "Check if case marked as duplicate" (step 16). Select case in the first drop down and the name of the dialog you are working on from the lookup. It is important that you select the dialog to run as a child process, as well as on demand, for it to show up in the lookup.

















Activate the Dialog and test it!

No comments:

Post a Comment