USD – Send Emails

Here I describe how you can create a toolbar button in an accounts navigation bar to send an email. You can adapt this idea for other entities or even combinations! (As you might want to send an email to a contact but regarding a case.)

The steps involved are;

  1. Create a hosted control to be the email tab. (If you haven’t got one already.)
  2. Create an action to load a new email tab, populated with details from the account.
  3. Add a toolbar navigation button to the account.
  4. Ensure you have a suitable window navigation rule.

I’m going to assume you understand toolbars, if not see my earlier post on these.

You can of course take a similar approach but call the action from an agent script.

Step One – Email hosted control.

Simply navigate to hosted controls in the Unified Service Desk settings and add a new control like the one below.

Things to note include;

  • Display name: I decided to set the to the subject of the email, it will actually be “Email” until a subject has been set
  • USD Component Type is “CRM Page”
  • Display group is “MainPanel”

Step Two – Create an action to load a new email tab, populated with details from the account.

Now navigate to the actions area in the unified service desk settings and add a new action. Mine is shown below. Things to note include;

  • Hosted control is Email. (the one you just created)
  • The action is New_CRM_Page, this is going to load a new page and populate it with values. But it isn’t going to save / send the email just yet.
  • The data portion is shown below, here you populate the email with various details from the account. (You could adapt for other entities!)

Step Three – Add a toolbar navigation button to the account.

You’ll need a method to trigger the action, I chose to create a toolbar button. I simply added a new toolbar button to an existing toolbar I had created for account navigation. You may also consider adding an answer to an agent script to send email.

My toolbar button looked like the one below. Things to note include;

  • Image, msdyusd_Email16. I opted to just have an icon in the toolbar, no button text was needed.
  • Order 7, as this is the 7th button in my toolbar.
  • After saving the toolbar button I have added the action just created.

Step Four – Ensure you have a suitable window navigation rule
Before “messing” with your windows navigation rules test what you have already written, it may work. If not a probable reason is you haven’t got a suitable window navigation rule. I think the reason is the navigation rule needs to load the correct hosted control ready to receive the new page you’ll trigger with the new page action. Things to note include;

  • From is “Email”.
  • Entity is “Email”.
  • The route type is “Popup”. (If popup doesn’t work try again with “in place”, I know not scientific but in my experience the setting of route type has been a bit hit and miss!)
  • Show tab and target tab are “Email”.
  • I have opted to set hide navigation bar to “yes”, just because I like to remove as much navigation as possible. But “no” is also a valid answer here.


Final tip, if you need to debug this you’ll be looking for your debug results to look like those below. Notice that you can see the windows routing rule fire before the New_CRM_Page action. And that all of the parameters have sensible values.


I admit this was a little tricky to get right first time but once you’ve got this working on one entity it is easy to replicate.

19 thoughts on “USD – Send Emails

  1. Pingback: Learning USD | My experiences with Microsoft Dynamics CRM and Unified Service Desk

    • Hi sir,

      I have just try to implement this particular Blog on E-mail activity inside the MS USD but couldn’t & when I checked the Error appears highlighted in Red, Inside the Debugger hosted control in the USD, when I hover around over this error, I was getting Error message “Not all the parameters in the action call New_CRM page are available”. So, Please check the coding part in this blog & Revert As soon as possible.

      Thanks !!!!!!!!!!!!!!


      • I will check the post is correct tomorrow, I actually had a similar problem earlier when creating an action call to create an opportunity. Depending on your situation it might be best to use syntax something like [[$]+] sometimes replacing say contact. with $context. can help. Also the + is useful, as this handles nulls. This sort of stuff can be tricky to get working as debug messages aren’t always very detailed. Can you send me a copy of your debug output, that might help me see what is happening.


  2. Hi sir, Firstly Thanks for your reply. I have a “Mail Button” on the Main Toolbar inside the Microsoft USD on clicking of this button; there is E-mail Tab opens in the Navigation Toolbar which is currently displaying nothing, & the error inside debugger is already mention by me. Share Can please share your e-mail id with me, as I am not able to upload the error output here.


    • Yes, you can email me at

      I suspect this is a windows navigation rule issue. I will update the post to explain soon. Basically the windows navigation rule needs to trigger the load of the required CRM Page. The action to create the email needs that to be ready to receive the email. So I think this is a sequencing issue. It you send me a copy of some debug output I should be able to confirm. (I hope!)


  3. I’m curious as to how you got the CreateEntity to work. I ran similar code through the Debugger and it doesn’t like the fact that ‘partyid’ isn’t on the email entity.


    • I based the code on a similar action that already existed in the Microsoft sample solution. I have used it several times on on-premise and online versions of CRM.

      I have found that the whenever I’ve used the “New_CRM_PAGE” action the windows navigation rules play a big part. Even though the debugger shows all the values set as you expect. The windows navigation rules needs to have already triggered the load of a suitable tab. I have added information in my post about this and shown the results I got in the debugger when this works. Hopefully that will help.


  4. Just one question, If we have to modify the same post, to mail any of the contact from MS CRM, then below code is correct one or not ?



  5. Pingback: Happy New Year – Pop Pickers | Microsoft Dynamics CRM and Unified Service Desk

  6. Neil, have you had any issues around inserting a template to an email in usd and then attaching files? when i go to insert attachments after i have inserted the template it crashes usd.


    • Hi Una,

      I hadn’t seen this problem but since getting your message I have tried it. USD does crash when I add an attachment. (Even without a template.)

      I think I can see the problem.

      When you click the “+” on the attachments sub grid the form changes. Meaning the email is no longer on the screen. Having added the attachment when you click close, to return to the email USD crashes.

      I suspect the solution would be to make the attachments show in a separate tab. I guess this would need a window navigation rule but I haven’t worked out exactly what that needs to look like.

      I did however see that the email attachment does get added correctly. Which is one positive!

      I suggest you try to get a separate tab to load when adding attachments to emails.

      If that doesn’t work maybe consider raising a support ticket with Microsoft. because USD is crashing this does sound like a product bug.

      Please let me know how you get on as this problem interests me!

      Thanks (and sorry I haven’t got an instant fix)



  7. Pingback: USD – The Book | Microsoft Dynamics CRM and Unified Service Desk

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s