CRM Software Logo

Microsoft Dynamics 365 & Dynamics CRM experts provide reviews and opinions to aid professionals with the Dynamics 365 selection process.

 
 
BDO Solutions

Mark a Task as Complete, and Automatically Prompt to Create a New Task

Email | Print

Recently, a client requested that a dialog process start immediately after a task or phone call was marked as completed, to prompt the user to create a follow up task or phone call. For this example, I am only showing how to create a follow up dialog from task records that have accounts linked to them.

For ease of use, I prefer to use the Visual Ribbon Editor to edit CRM ribbons. Because it is not possible to alter the functionality of a default CRM button using this editor, I created another button that looks like the original but automatically starts the dialog process instead. To do this, the button action will call a JScript function which in turn will start the appropriate dialog process.

Step 1 – Create the CRM Dialog Process

The first step is to create a dialog in CRM. Note that this example only shows a check to see if the task is linked to an Account. Additional steps could be added for tasks linked to a Contact or other entity as well.

Step 1a

Add a Check Condition Step

Add this first step to check if the Regarding field of the task is linked to an Account, and add 5 steps underneath this one as shown in the screen shot. The details of the sub-steps have been hidden to show the basic structure.

Step 1b

Add a Page Step

This step will present a window to the user asking the type of follow up activity to create. After adding the Page, add a Prompt and Response step that asks the question and remembers the answer for the next step.

Step 1c

Set the Properties as:

  • Statement Label = Account – Type of Activity?
  • Prompt Text = What type of follow up activity do you want to create?
  • Response Type = Option Set
  • Log Response = Yes
  • Provide Values = Define Values
  • Response Values = None, Task, Phone Call

Add a No Follow Up Step

In this case, the user has indicated that there will be no follow up task. The original task will be completed, and no additional steps will be performed. Under this step, add a Change Status step and then a Stop Dialog step.

Step 1d

Add another Page Step

The next question is to find the follow up date for the activity to be created. Add a Page step with a Prompt and Response step below it.

Step 1e

Set the Properties as:

  • Statement Label = Account – Follow Up Date?
  • Prompt Text = When would you like to follow up?
  • Response Type = Date Only
  • Log Response = Yes

Add a Check Condition – New Task

In this case, the user chose to create a follow up Task. Add a Check Condition, then Create a new Task Record.

Step 1f

Set the Properties using Dynamic Values, as:

  • Subject = Follow Up: {Subject(Task)}
  • Regarding = {Account(Regarding (Account))}
  • Owner = {Owner(Task)}
  • Due = {Response Text(Account – Follow Up Date?)}

Add a Check Condition – Phone Call

In this case, the user chose to create a follow up Phone Call. Add a Check Condition, then Create a new Phone Call Record. The properties will be the same as the Creating a New Task step.

Step 1g

Save the dialog.

Step 2 – Add a JScript Web Resource to CRM that Initiates the Dialog

This JScript function will be called by the action of the new CRM button that will be created in Step 4. It will launch the Dialog that was created in Step 1.

To do this, create a new JScript web resource called Globals. Note that the actual file name will be of the format NEW_Globals. This will be needed in Step 4.

In the Text Editor, enter the following code:

Step 2a

Save and Publish the Customization

Step 3 – Launch the Visual Ribbon Editor

The Visual Ribbon Editor can be downloaded from http://crmvisualribbonedit.codeplex.com/, and then click on the VisualRibbonEditor.exe file to launch the application. Once the application is running, click on the Connection button (first button on the left) to establish a link to the CRM ribbons.

Step 3a

Then, click on the Open button to display the Open Entity Ribbon window. From the drop-down list of entities, select the associated ribbon to customize.  In this case, it will be the Task ribbon.

Step 3b

Step 4 – Add the New Button

Since we want to add a button to the Task form itself, choose Form as the Ribbon Type.  Also, the Main Tab corresponds to the Task tab of the ribbon as displayed in CRM.

Step 4a

CRM:

Step 4b

Now, select the Save group and click New Button.

Step 4c

Choose a prefix and button name. This will probably be the same prefix that is used for customizing fields and entities in CRM.

Step 4d

New Button Details

Copy the Label, Tooltip, Template Alias, 16x16 Image, and 32x32 Image from the Details tab of the original button (Save As Complete). Then, change the Sequence of the new button within the Save group by using the arrow buttons or entering the value in the text box.

Step 4e

New Button Action

It is not necessary to copy the Action from the original Save As Complete button. The new Mark Complete will only call the dialog that we created in Step 1.

Add a JavaScript Function with Function Name = LaunchModalDialog, and Library = /WebResources/NEW_Globals. Then to the right of the function, click the Add link to add 3 parameters for the function which will be created next.

Step 4f

The first is a string parameter with the GUID of the dialog created in Step 1. This can be found by opening the dialog process, and looking in the title bar of the window. Note that there will be extra characters before and after the GUID.

Step 4g

The second is a string parameter with the type of entity that is launching the dialog. The third is a CRM parameter that represents the original task record.

Hide Original Button

Since the original Save As Complete button is no longer needed, select that button and click Hide. It can be unhidden later if necessary.

Save

Click the Save button at the top of the screen to save the ribbon to the CRM application.

Step 5 – Activate the Dialog

Now that all the pieces of the process are complete, the CRM dialog can be activated.

BDO Solutions is a national firm with local practices throughout Canada, including Ontario, Alberta, British Columbia, Manitoba and Saskatchewan. Microsoft Gold Certified Partner and Reseller of the Year in Canada for 2010, 2011 and 2012.

By Debra Polvi, CRM Consultant with BDO Solutions.

One Response to “Mark a Task as Complete, and Automatically Prompt to Create a New Task”

  1. Joseph Combopiano says:

    Great Post!

    I am doing almost the exact same thing for a project, and this definitely helped guide me in the right direction.

    Cheers,
    Joe

 

 
 
Show Buttons
Hide Buttons