819 Saturday, May 21, 2016 |
Shruti Roy
Dynamics CRM Consultant at Pwc

Email Router Demystified in MS CRM Part -2

Troubleshooting Outgoing email issues

To do this, we need to reference the mail flow diagrams shown in the Explanation post previously.  We’ll first cover the Outgoing portion of the Email Router.

Troubleshooting Outgoing email issues is the not a difficult part of the Email Router to troubleshoot.  The reason is that there are only two different configuration options, SMTP or Exchange Online.  Realistically, you troubleshoot these the same way.  Obviously we have some restrictions during the troubleshooting steps when working with Exchange Online but these should be pretty obvious.  Let’s go ahead and get into troubleshooting at this point.

 

The first thing to know about troubleshooting the Email Router is to remember the traffic flow.  This was shown in the second post of this series but I have included it here as well:

 

Each step represents a potential break point.  The key to troubleshooting is to understand where the error occurs and what the error is telling you.  So how can we determine where the issue lies?

 

The first step to this is to understand, what’s the state of the email within CRM?  There are three status the email can be when in CRM. 

  1. Pending Send
  2. Sending
  3. Sent

What’s an easy way of understanding what emails are in which state?  The typical recommendation I have made to our customers is to use Advanced Find on the E-mail Messages entity.  When building your Advanced Find, you will want to ensure you have, at minimum, the following columns: Subject, From, To, Status Reason, No of Delivery Attempts.

Note: The one thing I want to ensure is pointed out is the last column of No. Of Delivery Attempts.  This tells us how many times the Email Router has tried to send the email.  Anytime it goes from Pending Send to Sending, it increments this attempt by 1.  We delay sending emails that have higher Delivery Attempt counts.

Each of the email statuses signify a different step within the mail flow diagram above.  Let’s review each of these now:

  1. Pending Send: Pending Send means that the email router has not processed this email message yet or there was an error when it did process it and put it back into a pending send status to try to send it again at a different time.  The key to knowing how to differentiate these is to look at the Advanced Find.
     
    One Pending email with the Subject of “Failing Email” shows that the router has tried sending the email five times and it’s still unable to do so since the Status Reason is still Pending Send.  This tells me that there is an issue between the Email Router and the Outgoing service (SMTP or Exchange Online).  The email router was able to retrieve the message from the CRM server, validated the user information within CRM, and submitted it to the Outgoing service to be delivered.   For some reason, the outgoing attempt failed for this email and I can review the Event Viewer Application Logs for more information.   The other email in a Pending Send state, shows the delivery attempts as 0.  This means the router has not yet picked up this email for processing.  This could be due to quite a few reasons. 
    1. The User’s profile does not list E-mail Router in the Email Access Configuration for Outgoing:
    2. The user is not listed in the Email Router Configuration Manager after clicking on Load Data:

      This could be due to the Email Access Configuration for the user not set to Email Router for Outgoing or the user’s email address has not been approved.
    3. The user does have Email Access Configuration set to Outgoing and is in the Email Router Configuration Manager but the user’s GUID <UserId> is not present in the Microsoft.Crm.Tools.EmailAgent.xml file:

      In this case, the user’s GUID is B8DD579B-501D-E211-AA2E-00155D51F43.  The reason could be that after the user’s settings were changed to Email Router (Email Access Configuration) no one went back in the Email Router Configuration Manager and clicked on Load Data and Publish.
    4. The user’s Personal Options do not allow the Email Router to do processing on their behalf.

      CRM 2011:

      CRM 2013:

      The setting for “Allow other Microsoft Dynamics CRM users to send e-mail on your behalf” is needed for those that generate emails and change the from field to use your account.  

      The setting “Allow E-mail Router to use my credentials to send and receive e-mail on my behalf” is required when the Outgoing profile within the Email Router Configuration Manager is set to User Specified for Access Credentials.
  2. Sending: Sending means the Email Router is currently processing the message.  It has already accepted it from CRM and is currently waiting for the Outgoing service to accept the message.  A failure here would send the email back into a Pending Send status and then Delivery Attempts would have been incremented.  If the issue is occurring at this step, then you are going to need to use some additional tools suggested below in the “Outgoing Protocols” section.
  3. Sent: This means that the Outgoing service has accepted the email for delivery and now it is up to the Email service to get the email to the To and CC addresses. 

Outgoing Protocols

We also need to understand the protocols being used for the Outgoing profile.  Each scenario dictates different types of tools and troubleshooting:

SMTP:

The main troubleshooting tool we will use for troubleshooting SMTP issues is some sort of network sniffer such as Microsoft Network Monitor (NetMon) or WireShark.  Being the company man that I am, let’s take a look at what NetMon will show us. 

 

By adding a Filter of “ProtocolName == “SMTP”, I can easily see all of the SMTP traffic.  Now the error the
problem email is the following:

 

Looking through the traffic, I can see that the Exchange server, for “some reason” is throwing Reset packets:

 

By looking at the NetMon traffic, I knew the issue was coming from the Exchange server and there must be some sort of configuration problem on that particular server.  If the issue was intermittent, maybe it was one of the servers in the environment having problems.  After doing further troubleshooting, it was found that, the firewall on the Exchange server was blocking the traffic from the CRM server. 

Exchange Online:

Exchange Online is using Exchange Web Services (EWS) to send emails.  In this case, we can use Fiddler to see what the response coming back to CRM is.

Additionally, we can use a tool called EWSEditor found on CodePlex.  EWSEditor allows us to emulate the same requests as what is being done by the Email Router.  In the screenshot above, you can see that CRM is making an EWS call to GetFolder.  You’ll notice that the Email Router is going to use the schema version for Exchange 2007 SP1, just a tip when using EWS Editor.  We’ll get into the actual usage in a tools post here.

The next part of this post is to cover Troubleshooting Incoming email issues.

Introduction to Microsoft Dynamics Marketing

Chart Visualization Multiple Category Charts (4 of 5): Dynamics CRM 2011

This Snack shows how to use chart designer to quickly and efficiently create graphs and charts to monitor business metrics in Microsoft Dynamics CRM 2011 At Training Material Completion After you complete this snack you will be able to:

• Add and delete entities

• Refresh the metadata

• Manage profiles

• Import and export profiles

Office 2010 / Microsoft Dynamics CRM Demo -- Coordinating Sales and Customer Support (Part 1 of 2)

In this demonstration, you will see how the user, such as an account manager, can easily access customer information from a central dashboard in SharePoint Server 2010, and also seamlessly access customer data stored in Microsoft Dynamics CRM.

New ways to reach more prospects with SMS Marketing

Discover new ways to reach more prospects with Microsoft Dynamics SMS Marketing. Watch this video to see how a typical SMS Marketing flow works, and learn how to leverage the high response rates of text messaging for your business. You'll see how to set up text messaging key words and short codes, configure opt-in and opt out workflows, link key words to marketing lists, manage your subscribers, and set up rules to limit touch points and avoid overwhelming them.

[Job] - L&T : Microsoft Dynamics CRM Sr. Developer, United States

Company: L & T Infotech

Location: Farmington, CT, United States

Job Code: 14400
Title: Microsoft Dynamics CRM Sr. Developer
Location: Farmington, CT, United States


Description:

Language Required

  • Spanish & English or
  • Portuguese & English Or
  • Spanish, Portuguese & English

Skills

1.Education – B.E., B. Tech, MCA, Around 5 to 8 yrs or more years of relevant experience.
2.Certified professional (Configurations, customizations and Extensions) and having experience in
Installation (considering accessing via Microsoft Outlook and Mobile), customizations in On-Premise, Online model (considering best practices within Microsoft Dynamics CRM), and customization of reports in On-Premise and Online model. {Experience in Online model a must}


1.Experience in Integration with third party applications.
2.Working knowledge of Microsoft SQL Database, Windows Server Operating System, Active Directory and Active Directory Federation Services.
3.Experience in SSIS (SQL Server Integration Services) and aware of sizing of hardware and software would be an added advantage
4.Project Lead experience
5.Understanding of standard available sales, marketing and service module functional flows
6.Experience in developing reports in SSRS (SQL Server Reporting Services), xml based reports a must
7.Awareness and working experience of various technologies like HTML, CSS, SOAP, REST, Silverlight, Angular JS

Required Experience (Same as Relevant Experience)

1.5 to 8 yrs or more years of MS CRM Sr. Developer / Technical experience

Job Responsibilities

1.Technical consultant with MS CRM background, having worked on the MS CRM product extensively and done 4 - 6 end to end implementations.
2.Worked on CRM 2013 version onwards until latest version.
3.Also having done projects on premise and cloud, support, upgrade and migrations.
4.Aware of mobility in MS CRM CRM and access of MS CRM via Outlook - Online and Offline.
5.Knows the MS Sure Step methodology well; able to articulate and understand the pain points of customer.
6.Design the solution, configure and customize to address the pain points and deliver it is one of the key responsibilities.
7.Design, develop solutions, identify bugs and resolve the issues/bugs.
8.Preparation of technical related documentations.
9.Should be customer facing with excellent analytical and communication skills.
10.Lead a team of resources, allocation and estimation of tasks.
11.Troubleshooting any issues.

Key Skills: Microsoft Dynamics CRM Sr. Developer
Education Qualification: Associate Degree

Form events in MS CRM?

  • OnLoad Event
    • The OnLoad event occurs after the form has loaded.
    • It cannot prevent the window from loading.
    • Use the OnLoad event to apply logic about how the form should be displayed, to set properties on fields, and interact with other page elements.
  • OnSave Event
    • The OnSave event occurs when:
    • The user clicks the Auto save button button in the lower right corner of the form, even when there is no changed data to be saved.
    • Code executes the Xrm.Page.data.entity.save method, even when there is no changed data to be saved.
    • The user navigates away from the form and there is unsaved data in the form.
    • With auto-save is enabled, 30 seconds after data has changed and there is unsaved data in the form.
    • Code executes the Xrm.Page.data.save method and there is unsaved data in the form.
    • Code executes the Xrm.Page.data.refresh method passing a true value as the first parameter and there is unsaved data in the form.
  • Field OnChange Event
    • The OnChange event occurs when:
    • The data in a form field has changed and focus is lost.
    • Radio buttons or check boxes clicked.
    • Calling Xrm.Page.data.entity attribute.fireOnChange method.
    • The OnChange event does not occur if the field is changed programmatically using the setValue method. If you want call attribute.fireOnChange method.
  • Tab TabStateChange Event
    • The TabStateChange event occurs when the DisplayState of the tab changes due to user interaction or when the setDisplayState method is applied in code.
    • Use this event when you wish to change the src property of an IFRAME within the tab.
    • If you set the IFrame src property in the OnLoad event for an IFRAME within a collapsed tab, the value will be overwritten when the tab is expanded.
  • IFRAME OnReadyStateComplete Event
    • The OnReadyStateComplete event indicates that the content of the IFRAME has loaded and can be accessed in code.
    • Use this event when referencing IFRAME controls within your scripts.
  • Lookup Control PreSearch Event
    • The lookup control has a PreSearch event that occurs just before the control launches a dialog to search for records.
    • There is no UI to set event handlers for this event.
    • You must use the addPreSearch and removePreSearch methods on the lookup control to add or remove event handlers for this event.
  • OnProcessStatusChange Event
    • This event occurs when the status of a process instance changes.
    • Use the Xrm.Page.data.process.addOnProcessStatusChange method to add event handlers for this event
    • and the Xrm.Page.data.process.removeOnProcessStatusChange method to remove them.
  • OnStageChange Event
    • This event occurs when the user clicks the Next Stage or Move to previous stage buttons in the user interface
    • or when a developer uses the Xrm.Page.data.process.moveNext or Xrm.Page.data.process.movePrevious methods.
    • You can’t cancel the stage change using code in a handler for this event.
  • OnStageSelected Event
    • This event occurs when a stage of a business process flow control is selected.
    • You can’t cancel the stage selection using code in a handler for this event.
  • Knowledge Base Search Control Events
    • The knowledge base search control can only be added to forms for organizations that has the knowledge management feature enabled. This control has two events (OnResultOpened and OnSelection) that developers can programmatically assign event handlers to.
  • Subgrid OnLoad event
    • Subgrids load asynchronously from the form so you can’t reliably get access to the data in the subgrid in the form OnLoad event. But you can set an event handler for the OnLoad event of the subgrid.
    • This event will occur each time the data in the grid is refreshed, this includes when users sort the columns of the grid.
  • Editable Grid Events
    • OnRecordSelect
      • The OnRecordSelect event occurs when a single row (record) is selected in the editable grid. This event won't occur if a user selects different cells in the same row, or selects multiple rows.
    • OnChange
      The OnChange event occurs when a value is changed in a cell in the editable grid and the cell loses focus. This event can also occur when an attribute value is updated using the setValue method.
    • OnSave
      • The OnSave event occurs before sending the updated information to the server, and when any of the following occurs:
        There is a change in the record selection.
        The user explicitly triggers a save operation using the editable grid’s save button.
        The user applies a sort, filter, group, pagination, or navigation operation from the editable grid while there are pending changes.

Working offline with Dynamics CRM mobile apps

Thanks to Dynamics CRM mobile apps, you don't have to stop working just because the network does. In this video we'll show you how to set up and use CRM's offline experience. Network disruptions no longer matter. When you reconnect the app, everything you added offline will be there.

Difference between Web API, Organization service and Organization Data service in Microsoft Dynamics CRM

Web API

Web API is introduced with Microsoft Dynamics CRM 2016 and will provide parity with the Organization service.

Key points about Web API:

  • Web API provides parity with Organization service with some limitations.
  •  It implements  OData (Open Data Protocol) version 4.0 which is an open standard for building and consuming RESTful APIs over rich data sources like DOC, HTML and PDF.
  • Because Web API is built on open standards therefore it's no necessary to use Microsoft Dynamics CRM provided libraries, third-party libraries can be used to generate classes. 
  • You can compose own Http requests as well. 
  • Wep API supports wide variety of programming languages (including .Net, C++, Java, JavaScript, Python), platforms and devices as compared to Organization service.
  • Web API will gradually replace Organization service and Organization Data service to become single web service for Microsoft Dynamics CRM.
  • Wep API Request and Response have JSON format, so its very easy to work with Wep API from JavaScript.
  • Authentication is provided by the application itself when used within web resources, form scripts and ribbon commands. 
  • Maximum 5000 records can be return for each request.

Organization Service

Organization service is available since Microsoft Dynamics CRM 2011 and is mainly used for server side development i.e. code running on Microsoft Dynamics CRM server.

Key points about Organization service:

  • Implements IOrganizationService interface.
  • Organization service is also know as SOAP endpoint.
  • Microsoft Dynamics CRM uses Windows Communication Foundation (WCF) to SOAP endpoint.
  • It is the primary web service for accessing data and metadata from Microsoft Dynamics CRM organization.
  • It is built on WCF and optimized for use with the .Net.
  • Organization service request and response has SOAP format.
  • Microsoft Dynamics CRM SDK provides assemblies and tools to generate strongly typed classes and proxies to simplify developement in Microsoft Visual Studio.
  • Maximum 5000 records can be returned in a single query.

Organization Data Service

Organization Data service is available since Microsoft Dynamics CRM 2011 and is mainly used for client side development (code running in browser)  using JavaScript. 

It supports JSON format for request and response which can be easily handled from JavaScript, therefore this is preferred service for client side development.  

Key points about Organization Data service:

  • It is preferred service for client-side development.
  • Organization Data service is also known as "OData" or "REST" endpoint.
  • Microsoft Dynamics CRM uses Windows Communication Foundation (WCF) to provide REST-based service.
  • It supports JSON and ATOM format.
  • Organization Data service can be used within Web resources, form scripts and ribbon commands.
  • Authentication is provided by the application itself, no need to write authentication code.
  • It implements OData v2 standard.
  • It is deprecated with Microsoft Dynamics CRM 2016, Web API should be used to support Microsoft Dynamics CRM 2016 and future versions.
  • It can return maximum 50 records in a single retrieve operation.
  • It is much fatser as comared to Organization service, because less bytes in JSON message in comparison to SOAP message.

 

Customization Toolkit Overview - Microsoft Dynamics CRM 2011

This video is an overview of how to customize Dynamics CRM 2011. The video goes through a design scenario that demonstrates how to configure the forms, fields, views, charts and dashboards.

Microsoft Dynamics CRM 2011 - Pricing and Licensing

Color Grid for Dynamics 365

Color Form for Dynamics 365