Microsoft Dynamics CRM 2011 Workflow Based Approval Process implementation – Part 3

November 12, 2011

Microsoft Dynamics CRM 2011 Workflow Based Approval Process implementation – Part 3


This post is the last in a series of three posts which describe a common implementation problem of a business approval process, possible solutions and actual solution implementation.
Although in my example I used an approval process of a Quote discount %, this model can be used to implement any linear business approval process. 


While the first post presented the problem and requirements, the second post describes a specific possible solution. In this post I will explain the solution implementation and it’s characteristics.

In the first post I described the problem’s main characteristics:



  1. Each of the involved employees should be able to find out the stage in which the Approval process is at

  2. Involved employees should be notified on tasks which require their attention, even if they do not login to the application

  3. The process should behave intelligently if some stage has exceeded a certain amount of time. For example, If the CFO has not responded in 3 days, a proper notification should ne sent to the Sales Person

  4. Approval process is asynchronous in nature and should ‘wait’ for the next user input without consuming expensive system resources

  5. The process should be flexible, so it can be easily adjusted to an ever changing business requirements. For example, adding another approving role or an additional Quote related condition

  6. The process should be applicable for Online and On-Premise deployments

In the following step-by-step user scenario walkthrough, I’ll explain how each problem is solved.



Implementation Notes



  1. Team vs. User: In some organizations, an approval task can be assigned to specific user, while in other a team of users handle the approval task. Assigning an Approval record to a team, rather than to  a specific user, is useful when some employee is unable to document the decision (e.g home sick). In that case, any Team member can take and document the decision.
    In Microsoft Dynamics CRM 2011, Team can be assigned with Security Roles and can own records. These features allows you to assign the Approval record to to a Team. When an Approval record is assigned to a Team, the plugin component (E4D.CRM.Plugins.Approval) will handle sending email notification to each Team member.
    Since Team may have only one member, I find it more flexible and prefer assigning an Approval record to a Team rather than to a specific user. If you still want to assign an approval task to a user, change the Workflow rule described here.

  2. The implemented solution is based on the Workflow engine. I chose to let users activate the Quote approval process manually, but you may want to activate the process automatically when the Discount % value changes, using the proper Workflow trigger.

  3. The Workflow process structure has been divided into four rules to allow re-use and encapsulation. Still, adding or updating business parameters, such as Discount % levels and approving users/teams, are managed in the main Workflow rule (Quote Approval Process: Main ).

User Scenario Walkthrough



  1. Activating Quote approval process


Sales Person adds a Discount % value to an existing Quote, saves the Quote and clicks the Run Workflow button to activate the approval process



image


image




2. Approval record initiation



Approval record is created automatically by the Workflow and assigned to the Sales Person team. The Approval decision status is ‘undecided’. The Approval’s note reflects the business process stage.



image

image




3. Sales Manager Notification



Each member of the Sales Manger team receives an email notification regarding the pending approval task. The email notification includes a link to the Approval record.



image



image




4. Sales Manager decision


Sales Manager edits the Approval record and change decision to Approved and saves the Approval record


image




5. Approval record Status


The Approval record is assigned to the CFO team and decision value is again defaults to ‘Undecided’. The Approval record notes reflect the business process progress.
The CFO team members receive an email notification regarding the pending approval.


image



6. CFO approval


CFO team member decides to approve the discount % and changes decision to ‘Approved’. The approval record is assigned back to the Quote owner and its state changed to Inactive, as this is the end of the business process. The Quote owner receives a email notification regarding the approval granted.

image


Solution Details


The solution is packaged as a Microsoft Dynamics CRM 2011 Solution which can be downloaded here. This is a managed solution and before you activate it in your environment you will have to edit it in order to adapt some elements like users or teams. Following are the solution components:



  1. Quote entity customization – One custom attribute which is not visible in the entity form and is used to indicate if a Quote record is currently in an approval process

  2. Approval entity customization – Custom entity which represents the approval process data and process

  3. Quote Approval Process: Main – Main workflow rule which defines the approval process flow. It uses child workflows to implement repetitive logic. Before activating this rule, make sure you replace the Team/User with principals in your organization

  4. Quote Approval Process: Approval Stage – Child workflow rule which encapsulates approval process stage

  5. Quote Approval Process: Approval Granted – Child workflow rule which encapsulates approval granting logic

  6. Quote Approval Process: Finalize – Child workflow rule which finalizes any approval process logic

  7. Quote Approval Required notification – An email template used to notify a user that an his attention is required

  8. Quote discount % approved notification – An email template used to notify a user about a Quote discount % approval event

  9. Quote discount % disapproved notification – An email template used to notify a user about a Quote discount % disapproval event

  10. E4D.CRM.Plugins.Approval – A plugin component used to send an email notification the team members in the event of Approval record assignment

Conclusion


Microsoft Dynamics CRM 2011 is a very powerful mechanism which enables the configuration of a complex business process such as an approval process.
As Custom Activities are not supported yet in Online deployments, a plugin component can support custom business logic such as sending email notification to team members.
Please feel free to comment on the implementation methods and help improve this solution.



Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

17 comments

  1. Rene VroemenNovember 30, 2011 ב 8:47 PM

    Great solution idea! However, I have just downloaded the managed solution but I am not able to import the solution in a CRM OnLine system.
    The problem is caused by the PlugIn Assembly:
    “Failure 0x80044191 Unable to load plug-in assembly”
    Any Ideas?

    Reply
  2. ChrisDecember 21, 2011 ב 3:56 AM

    I too am unable to import the solution. Does it have any dependencies on other assemblies that are assumed to be installed (and registered) in the GAC?

    Does the importing of a solution reguire that the CRM Server (i’m on premise in a virtual machine) have any pre-requisite SDKs installed?

    Thoughts?

    Reply
  3. Yaniv ArditiDecember 31, 2011 ב 8:19 PM

    I have uploaded an updated version of the solution, please try importing this one.
    It seems I didn’t include some necessary components.

    Sorry for your inconvenience.

    Reply
  4. karmaloop 917January 17, 2012 ב 2:18 AM

    it’s not working for me . dont know why

    Reply
  5. Yaniv ArditiJanuary 17, 2012 ב 6:24 AM

    Do you receive an error message? If so, what is the message?

    Reply
  6. SrikarMarch 26, 2012 ב 8:31 AM

    Hi,

    Do you have the same solution for “Dynamics CRM 4.0”?

    Thanks,
    Srikar

    Reply
  7. joe arkleyMay 30, 2013 ב 12:43 PM

    This solution really worked for me and I adapted it to an opportunity approval. In testing I submit it for approval many times but on the odd occasion the workflow does get stuck on the waiting for a decision even when the decision has been made. I think it may be when I try to hurry things along.
    I find most time if i go back into the approval record and change the decision to undecided save then approved it then allows the workflow process to continue. Have you encountered similar things? Is it just workflow timing issue? Anyway thanks for helping me out with a great solution and well documented. Given that the approval record fields are security enabled what do you suggest as the minimun security level for the approvers and also for the approval submitter in terms of access to the custom entities that your solution provides. Well done and kind regards

    Joe
    jarkley@hotmail.com

    Reply
  8. KevinJuly 11, 2013 ב 3:35 PM

    Does expanding this to other entities just entail adding additional 1:N relations to the Approval entity?

    Can you post full source/unmanaged solution?

    Reply
  9. ManuApril 11, 2014 ב 12:06 PM

    Hello!

    I recently started working on CRM and I am trying to implement similar kind of Workflow(for Approval Process).I found this blog very helpful.
    I tried importing this solution as managed for CRM Online and succeeded. But.But i cannot edit or change anything.So I changed the tag in the Solution.xml to convert to Unmanaged Solution.
    When i am trying to import the Unmanaged Solution, i get
    Package Validation(XSD ValidationHandler) problem.
    It is because it validates solution Package schema.

    It would be great if you provide the Walk through on how to create the Workflows and Custom Activity step-by-step because i cannot find any blog which explains this!
    Any suggestions or advice to make it work would be a great help!

    Thanks,
    Manu.

    Reply
    1. ManuApril 14, 2014 ב 11:25 AM

      Hello!

      Did you use any custom Workflow activities or Custom Workflow to implement this Approval Process or just created it in CRM Workflow(Processes)? At least this would guide me in a direction of whether to use Custom Workflows or not.

      Thanks,
      Manu.

      Reply
  10. Kerberos KingJune 24, 2014 ב 5:20 PM

    Hi,
    When I import the solutions have 2 errors, I think is language problem which I saw your entity have some words system cannot recognize,
    do you have fully English version to let me try and modify it?
    my email is Khoh@Outlook.com
    thank you’
    Kerberos

    Reply
  11. BhavikaAugust 14, 2015 ב 12:19 PM

    Hi Yaniv Arditi

    I want to check all the workflows, how its working and mainly how its handling the disapproval process.
    when i am trying to import your solution, its not supported in 2015.
    Can you please help me by sending the screen shots of all 4 approval workflows
    I would be a great help to me..

    Thanks in Advance

    Reply
    1. rdtAugust 16, 2015 ב 9:51 AM

      Hi,

      This solution was created for version 2011 and can not be imported directly into 2015. I suggest importing into an 2011 organization (even a virtual machine) and manually copy the business logic to 2015 organization process.

      Reply
  12. Piyush PaliwalSeptember 8, 2015 ב 2:09 PM

    Hi Yaniv, this solution looks great for most of the needs. I have a specific scenario and was looking at how this approach can be implemented for that.

    Basically, we have an account which gets updated in different stages. What I mean is that there are certain sections which should only updated by certain team. So, initially at stage 1 only basic account details come in then record is assigned to different team (stage 2), they update lets say financial attributes and ultimately goes on to the final approvers (stage 3) who review the entire sections and make a decision.

    What is the best way to achieve this update/approval logic.

    Reply
    1. rdtSeptember 8, 2015 ב 2:50 PM

      Hi Piyush,

      The process you describe seems simple enough to support with ‘regular’ (without using this solution) Workflow Process since it does not require sending the Account record back to initial stage.
      I would implement with a Workflow while assigning the record to the proper team/queue relevant to each stage.

      Reply
      1. Piyush PaliwalSeptember 8, 2015 ב 6:01 PM

        Ok, I missed one important point here. People update sections AND/OR also approves or rejects which decides that the record should go to next stage or shift to previous stage or goes back to the initial stage.

        Also, lets take this logic further. Lets say my final approval rejects the record (what will happen to the hidden attribute on opportunity? will it be reset/cleared? or changed to Rejected?). According to the solution an email will be triggered with the rejection comments and the workflow ends here.

        So now I have incorporated the changes which were suggested by final approver while rejecting, will I have to create a fresh approval record? If yes, how are we going to show all the notes (ideally the end user would want to see the entire comments history from previous approvers).

        Let me know your thoughts.

        Reply
        1. Piyush PaliwalSeptember 8, 2015 ב 9:23 PM

          I went through the articles completely and now it makes much more sense. Please ignore my previous comment, I think I figured all the answers to my silly questions :). Misinterpreted the solution earlier.

          Anyway, great article, loved it entirely.

          Reply