Goals in D365/CRM are a bit of a pain in my opinion. Having been tasked with setting them up for about 15 sales people every month I can say it’s not the nicest of features. However, it’s an important feature. I wondered if there would be a way to have them created automatically, and found this article which is well worth a read. Then I wondered how we could extend the goals further to add value to the sales reps (or whomever you are setting the goals up for) and provide goal updates via email.
Once a sales rep is a little closer to achieving the goal, why not let them know and provide a little extra information. The following steps explain how to send an email doing just that. First, make sure your goals are set up. I’m using a generic annual goal for this example and tracking revenue with the target being a monetary amount.
Actuals are based on Won Opportunities and the In-progress is based on Open Opportunities.
Once the percentage achieved changes, I wanted to see if we could send an email to the owner of the goal detailing their current actual and in-progress amounts, and provide them with a list of Opportunities that are approaching their estimated close date within the next month, and also provide a list of those where the estimated close date is in the past or was never added. This could help them keep their records up to date, and maybe help spur on the closing of additional Opportunities. I wasn’t sure how I could add a list like this to a workflow…. until I came across Workflow Elements from Microsoft MVP Aiden Kaskela. There is so much to this solution, this blog will only cover a small fraction.
First, I created two views using Advanced Find. The first will find all Opportunities that are Open, and are estimated to close within the next month. It then links the Owning User of the Opportunities to the owner of the Goal.
The second one will find all Opportunities that are Open but the estimated close date is in the past, or it’s missing. It then links the Owning User of the Opportunities to the owner of the Goal. Give both views a logical name because you will need to find them in the next step.
Next, I set up a workflow against the Goal entity. It’s set to start when the Percentage Achieved field changes. There is a condition to check that the Goal Status is active (which it should be if any fields are changing!) but you could add conditions based on the name of the field, or a specific Goal Manager etc. Next is where Workflow Elements comes in to play. We are adding two separate ‘ElementsQuery -Get Results’. Make sure you give them logical names as we will use them later on in the process to add to the email body.
In the properties for each one we are able to add details of how the table of results should look for the opportunities that will be listed out in an email. I’ve kept the default settings for the purpose of this example, but using the hex colour we can change specific elements to meet a companies branding. Then pick the system or personal view you created to show the opportunities. You’ll do this twice, one for each view.
The last part of the workflow is to add the email. We’ll send this from the Manager of the Goal Owner, and send it to the Goal Owner. Add in the content you wish to send. In the place you wish to add the list of Opportunities, look for the first step you added for the upcoming opportunities, then look for the old opportunities. For each one you will add the Table – Query Results (HTML) option like you see below.
That’s it! Save and publish the workflow. Next time an Opportunity is closed as Won, this will update the Percentage Achieved on a goal. The email will then be sent and will look something like this:
How cool is that? The sections listing the opportunities is all the work of Workflow Elements.
As an added extra, we can also add a workflow to update the activity wall in CRM and let the rest of the organisation know about the success of the sales team. Rather than having it update for each person, you could consider it updating for a team parent goal (if you have one). Create the work flow on the Goal entity and the change of the Percentage Achieved field as before. Then, create a post record using something similar to below:
Once the workflow runs, you will see the post in the What’s New area of CRM/D365.
Hopefully that gets the wheels turning and you can see how Goals could be extended and utilised more within an organisation. Can you think of any other ways you could make this area a more exciting and engaging piece of functionality?