Wednesday, February 26, 2014

Integration Guide: Microsoft Dynamics CRM Online and Office 365

Thanks to Jim Holtzman for sharing and making it available on the Download center

Some of what this paper covers:

  • Add an Office 365 trial subscription to Microsoft Dynamics CRM Online
  • Set up CRM Online to use Exchange Online
  • Set up CRM Online to use SharePoint Online
  • Set up CRM Online to use Lync Online
  • Set up CRM Online to  use Yammer

MSDN CRM Blog - Integration Guide: Microsoft Dynamics CRM Online and Office 365

Available from the Download Center:

Tuesday, January 8, 2013

Blog moved to

First of all wish all of the readers a very happy and successful new year.

After completing one year in Microsoft I finally got my own MSDN blog address (, from now onwards I will be writing new posts in my new blog.

stay tuned for more in my new Blog :-)

Friday, October 12, 2012

Microsoft Dynamics CRM 2011 Update Rollup 11 released

Microsoft Dynamics CRM 2011 Update Rollup 11 released

UR 11:

Highlights of Update Rollup 11

• 102 total fixes.

• 36 customer-escalated issues (see KB for details).

• Improved compatibility with Windows 8, Office 2013 and Touch.

General Information on Update Rollup 11

• The KB is located at

• The UR 11 blog is located at

• UR 11 is scheduled to be published via Microsoft Update on October 23.

Monday, July 4, 2011

Microsoft Dynamics CRM 4.0 Whitepapers

Here is a list of some beautiful whitepapers for CRM developers, it always worked as a good reference to me. so thought of sharing it with others too.

you can use them for a reference point or for knowledge building or to understand the product better.

Whitepaper Download

This white paper, details the security model leveraged by Microsoft Dynamics CRM 4.0, including information on the authentication mechanisms that, depending on the deployment model, support Microsoft Dynamics CRM. In addition, the document provides details about how access to Microsoft Dynamics CRM 4.0 system resources by users and external systems can be controlled and restricted.

The Microsoft Dynamics CRM Security Model

This white paper,provides selected aspects of the conceptual application of the security model in Microsoft Dynamics CRM. While Microsoft Dynamics CRM does not provide for true field-level security, there are a number of options available for using supported custom logic to control of access to data at a more granular level than provided out of the box. This document discusses some of the key options and constraints available for implementing this type of solution.

Field-level Security in Microsoft Dynamics CRM: Options and Constraints

Many data centers include firewalls between the end-users and the servers and other integrated systems that support an implementation of Microsoft Dynamics CRM 4.0. This document provides guidance on the connectivity requirements between Microsoft Dynamics CRM 4.0 and other systems to assist readers with proper firewall configuration in customer environments.

Connectivity and Firewall Port Requirements in On-Premise Deployments

Both the online and offline versions of the CRM Outlook Client support synchronizing CRM contacts and CRM activities to Outlook folders, or Outlook synchronization. This document describes the client synchronization process for Microsoft Dynamics CRM 4.0.

Outlook Synchronization in Microsoft Dynamics CRM 4.0

Using multiple instances of Dynamics CRM may be preferable in a number of scenarios. This release includes two documents, a white paper and a build guide, focused on sharing data across multiple CRM organizations. The white paper provides an overview of the levels of integration available for sharing data across multiple Dynamics CRM organizations, together with details about the techniques that are used for integration at the Application and Data levels, which include Web Services, Web Services-based solutions, Filtered Views, and SQL Server Replication.

Sharing Data across Microsoft Dynamics CRM Deploymentsc

Microsoft Dynamics CRM supports a wide range of business applications with the essentials required for building, delivering, and maintaining these applications in a multi-tenant SaaS environment. In this white paper we explore how, with Microsoft Dynamics CRM, an ISV can quickly build, deploy, and manage line-of-business applications.

Developing ISV Applications using Microsoft Dynamics CRM 4.0

This white paper provides techniques, considerations, and best practices for optimizing and maintaining the performance of Microsoft Dynamics CRM 4.0 implementations.

Optimizing and Maintaining Microsoft Dynamics CRM 4.0

These Microsoft Office Visio diagrams show the logical database structure for Microsoft CRM 4.0.

These diagrams were generated using the Metadata Diagram sample code included in the Microsoft Dynamics CRM 4.0 SDK download.

Microsoft Dynamics CRM 4.0 Logical Database Diagrams

Tuesday, June 7, 2011

How To Recreate Users in Microsoft Dynamics CRM


One of my teammate recently moved a CRM organization from one server to another server (database as well as the application server), don’t know what went wrong but after that one user complains that he can’t login into the system, when inspected we found that there are two records for the same user now exists in the CRM one disabled and one enabled also no entry of this user was there in MSCRM_CONFIG database.  Still in dark why and how it happens? but in order to let the user in the CRM we need to recreate the user in the CRM.


Now all we need is  to delete this user and recreate it in CRM, BUT BUT BUT…….

There is no supported option of deleting Users from CRM is available , at most you can disable them, but sometimes we found ourselves in a situation when we need to recreate the user in CRM as mentioned above.

we also need to remember that the CRM users are created from AD user accounts so the CRM will not allow you to create a new account even when one account is already disabled.

So what can we do:

The option with us is recreate a User record by changing the credentials of a user record and create a new record for the existing user.

we can do so by following the steps as mentioned below:

Step 1: navigate and open the desired User record in CRM.

Step 2: Change the user credentials in the Domain Logon Name field to and AD use record that is not already a CRM User and save the record.

Step 3: Since this record is not required in CRM at all so disable this record.

Step 4: Create the desired user record.

Step 5: Reassign the records of the disabled user to this newly recreated record.

Wednesday, April 27, 2011

Pre and Post Entity Images

Very Often I found during code reviews the most common mistakes new programmers commit during plugin development in CRM is usage of images at wrong places. so I thought of writing the same here, may be it helps someone.

first we should understand what are Pre and Post entity images:

PreEntityImages and PostEntityImages contain snapshots of the primary entity's attributes before and after the core platform operation. Microsoft Dynamics CRM populates the pre-entity and post-entity images based on the security privileges of the impersonated system user. You can specify to have the platform populate these properties when you register your plug-in. The entity alias value you specify during plug-in registration is used as the key into the image collection.

before using the images we should know when they are available. For example, only synchronous post-event and asynchronous registered plug-ins have PostEntityImages populated. In addition, the create operation does not support a pre-image and a delete operation does not support a post-image.

Hope it is helpful.

Happy Coding. Smile

Saturday, April 16, 2011

Microsoft Dynamics CRM 2011 – Visual Studio Plugin / Workflow Activity Templates

Just downloaded and checked the great artwork of pogo69. really helpful and saved a lot of time as you don’t have to write everything from scratch now.

checkout the awesome Visual Studio 2010 templates for Plugin and Workflow activity development for CRM 2011 created by him.



check these out at his blog:

Friday, April 8, 2011

List of changes in plugin development in CRM 4.0 and CRM 2011

There are not much changes in terms of plugins. there are few changes like instead of using DynamicEntity class we have to use the Entity class. the five major changes are :

1. The IPlugin now resides in Microsoft.Xrm.Sdk namespace instead of Microsoft.Crm.Sdk

public class ClassName : Microsoft.Crm.Sdk.IPlugin
public class ClassName : Microsoft.Xrm.Sdk.IPlugin

2. The Execute method signature of the IPlugin interface has changed, it now expects an IServiceProvider instead of the IPluginExecutionContext.

public void Execute(IPluginExecutionContext context)
public void Execute(IServiceProvider serviceProvider)

3. To get a reference to the IPluginExecutionContext you now need to call the GetService method of the IServiceProvider interface.

public void Execute(IPluginExecutionContext context)
Microsoft.Xrm.Sdk.IPluginExecutionContext context =(Microsoft.Xrm.Sdk.IPluginExecutionContext)

4. ICrmService has been changed to IOrganizationService.

ICrmService sdk = context.CreateCrmService(true);
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService sdk = factory.CreateOrganizationService(context.UserId);

5. DynamicEntity has been changed to Entity.

  • Properties property of DynamicEntity no longer exists

  • Getting and Setting values no longer use *Property classes,

eg: no more KeyProperty, StringProperty…etc, simply do int value = (int)entity[“schema_name”];

if (context.InputParameters.Properties.Contains("Target") &&
context.InputParameters.Properties["Target"] is DynamicEntity)
if (context.InputParameters.Contains("Target") &&
context.InputParameters["Target"] is Entity)

hats off to the original contribution by Gayan Perera

Happy Coding Smile

List of changes : Type mapping between CRM 4.0 and CRM 2011

In Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online, the programming model has been changed to use native .NET types whenever possible. A beautiful post from Resultondemand explains it all, with all credit to their great job the excerpts of the post is :

Type Mapping Between Versions
The following table shows the mapping between the defined type for an entity attribute, the type that is used in a record, and the type that was used in Microsoft DynamicsCRM4.0.

Attribute Type Microsoft Dynamics CRM 2011 Type Microsoft DynamicsCRM4.0 Type
AttributeTypeCode.Boolean bool or System.Boolean CrmBoolean
AttributeType.CalendarRules EntityCollection DynamicEntity[] or calendarrule[]
AttributeType.Customer EntityReference Customer
AttributeType.DateTime System.DateTime CrmDateTime
AttributeType.Decimal decimal or System.Decimal CrmDecimal
AttributeType.Double double or System.Double CrmFloat
AttributeType.Integer int or System.Integer CrmNumber
Not used in records.
Not used in records.
AttributeType.Lookup EntityReference Lookup
AttributeType.Memo string or System.String System.String
AttributeType.Money Money CrmMoney
AttributeType.Owner EntityReference Owner
AttributeType.PartyList EntityCollection or ActivityParty[] activityparty[] or DynamicEntity []
AttributeType.Picklist OptionSetValue Picklist
AttributeType.PrimaryKey System.Guid Key
AttributeType.String System.String System.String
AttributeType.State OptionSetValue or enumeration generated for the entity state EntityNameStateInfo
AttributeType.Status OptionSetValue orint Status
AttributeType.Uniqueidentifier System.Guid UniqueIdentifier
AttributeType.Virtual System.Object
Not used in records.
Not used in records.
Other Type Changes
Old Type New Type
CrmAttributeType Class (MetadataService) Microsoft.Xrm.Sdk.Metadata.AttributeTypeCode
Moniker Class (CrmService) Microsoft.Xrm.Sdk.EntityReference
SecurityPrincipal Class (CrmService) Microsoft.Xrm.Sdk.EntityReference
Happy Coding Smile

List of changes in JavaScript usage in CRM 4.0 and CRM 2011

When working with CRM2011 Java script you will found many difference about syntax/methods between CRM2011 and CRM4.0 Please check some of the comparisons as listed. Please click on the Image below to enlarge view. hats off to the original post contributor.


Happy Coding Smile

List of changes in Custom Workflow Assembly in CRM 4.0 and CRM 2011

here is a a quick list of changes you need to remember while creating workflow assemblies in CRM 4.0 or CRM 2011, as found here.

1. References

CRM 4.0

using System.Workflow.Activities;

using System.Workflow.ComponentModel;

using System.Workflow.ComponentModel.Compiler;

using Microsoft.Crm.Sdk;

using Microsoft.Crm.Sdk.Query;

using Microsoft.Crm.SdkTypeProxy;

using Microsoft.Crm.Workflow;

CRM 2011

using System.Activities;

using Microsoft.Crm.Sdk.Messages;

using Microsoft.Xrm.Sdk;

using Microsoft.Xrm.Sdk.Workflow;

2. Base Class

Base class definition has been changed from  SequenceActivity to CodeActivity.

CRM 4.0: In CRM 4.0 we have to specify both Workflow name and Workflowactivitygroupname in the code as written in the following code.

[CrmWorkflowActivity("My Custom Workflow", "CRM Workflow")]

public class MyCustomWF: SequenceActivity

CRM 2011: In CRM 2011 that is done in different way.

public class MyCustomWF: CodeActivity

Both Workflow name and Workflowactivitygroupname can be specified at the time of registering the assembly

3. Execute Method

The overridden Execute method remains the same except parameter and return type.

CRM 4.0

protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)

CRM 2011

protected override void Execute(CodeActivityContext executionContext)

4. Create service

CRM 4.0

IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));

IWorkflowContext context = contextService.Context;

ICrmService crmService = context.CreateCrmService();

CRM 2011

IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();

IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

5. INPUT Parameters

CRM 4.0

Declaration: how to initialize the input parameter

         // specified dependency property

         public static DependencyProperty CaseIDProperty = DependencyProperty.Register("CaseID", typeof(Lookup), typeof(TotalTaskRetrieval));

        // Specified Input property

        [CrmInput("Enter Case ")]

        // Set the reference Target for Property created


        // Property Defined for caseId

        public Lookup CaseID




                return (Lookup)base.GetValue(CaseIDProperty);




                base.SetValue(CaseIDProperty, value);



Use: Access the input parameter declared above as,

Guid caseid=CaseID.Value

CRM 2011

Declaration: how to initialize the input parameter

       [Input("Enter Case ")]

       [ReferenceTarget("incident ")]

       [Default("3B036E3E-94F9-DE11-B508-00155DBA2902", " incident ")]

       public InArgument<EntityReference> CaseID { get; set; }

Use: Access the input parameter declared above as,

Guid caseid = CaseID.Get<EntityReference>(executionContext).Id

6. OUTPUT  Parameters

CRM 4.0


        public CrmMoney Sum




                return (CrmMoney)base.GetValue(SumProperty);




                base.SetValue(SumProperty , value);



CRM 2011



public OutArgument<Money> Sum { get; set; }

happy Coding Smile

Thursday, February 3, 2011

The Underlying connection was closed: Unable to connect to the remote server

I was working on a program to import thousands of records in CRM when this issue first appears in front of me.  

This is typically seen in scenarios with Microsoft CRM when the server is under high user load or more typically when it is under high load from a Bulk import or a Microsoft CRM SDK application that is importing thousands of records into the application.  

what I was doing :The same user and CRM Service was re-used for all calls after successfully working for some time it stops and this error appears “The Underlying connection was closed: Unable to connect to the remote server” this error is a problem due to running out of TCP ports. You can minimize or eliminate this problem by setting the following registry keys on the Microsoft CRM Server(s).  

Note that these are both REGDWORD Keys and the values should be set as decimal values.


Create a new REGDWORD value named MaxUserPort with a value of 65534.  

Also create a new REGDWORD value named TcpTimedWaitDelay with a value of 30.

What this means is that we now have a total of 65534 TCP ports available and that they will recycle for use again after 30 seconds. This compares to the default of 5000 ports and a TcpTimedWaitDelay default of 240 (4 min).

enjoy :-)

Tuesday, January 18, 2011

How to change status of the dynamic entity?

to change status of the dynamic entity follow these steps:

   1:  //Create a request object

   2:  SetStateDynamicEntityRequest stateRequest = new SetStateDynamicEntityRequest();

   3:  //Use string and not integer value for state. (For Lead use "Qualified" and not 2)

   4:  stateRequest.State = newState;

   5:  stateRequest.Status = newStatus;


   7:  //Create an instance of the entity

   8:  Moniker m = new Moniker();

   9:  m.Id = entityId;

  10:  m.Name = myDynamicEntity.Name;


  12:  //Set the state. Well... set the entity.

  13:  stateRequest.Entity = m;


  15:  //Send the request

  16:  SetStateDynamicEntityResponse res = (SetStateDynamicEntityResponse)_crmService.Execute(stateRequest);

How to get rid of the CRM 4.0 “new_” prefix

Today one of my junior colleague asked me “Whenever I'm creating a custom entity in CRM, the type is prefixed with "new_". So are any attributes. How can this be modified/removed?”

although it’s quite simple but I thought many more minds might be thinking the same thing around the globe so I have decided to place it  here.

“new_” is the default prefix for custom entities and attributes.

To change it:

  1. Log into the web interface with an administrator account
  2. Select: Settings -> Administration -> System Settings
  3. Select the Customization tab
  4. Change the Prefix value to your desired one.

Happy Coding :-)

Wednesday, January 5, 2011

Don't upgrade to Rollup12 if you use push email


from Michael Dawson’s linkedin group post we got the info and got the solution too in our environment , so decided to share if someone too facing this issue. thanks Michael for sharing :-)

“We recently upgraded and have been hit with quite a major issue, when an appointment is synchronized from CRM to your Outlook Calendar, Exchange freaks out when trying to send it to your Smartphone device. You get inundated with the following message:
Synchronization with your SmartPhone failed for 1 items.
The following items couldn't be sent to your mobile phone. They haven't been deleted. You should be able to access them using either Outlook or Outlook Web App.
Item Folder: Calendar
Item Type: IPM.Appointment
Item Created: 21/09/2010 16:23:34
Item Subject: 1723 MDTEST
We have called Microsoft Product Support and this is a known issue that is being researched hopefully for inclusion in Rollup13. I have been advised to uninstall Rollup12 if I want to resolve the issue and go back to Rollup11.”

Thursday, October 21, 2010

Mapping MSCRM fields from Opportunity Product to Quote Product

For one of our customer we added some custom attributes in Opportunity product and like to add its mappings to quote product and same with quote product to order product so that Opportunity-Quote-Order process can work as expected and the values of the custom attributes in opportunity product could transfer automatically in Quote product.

Now the Big Question :

MSCRM does not directly list the relationship between a Quote Product and Opportunity Product within the available Customization User Interface.

Answer: a little googling and we got this. A very beautiful and simple Four step process:

STEP 1 –

Run a SQL Query against the MSCRM Database (typically Organization_MSCRM where Organization is the Name for the MSCRM Deployment) to determine the GUID Id of the Relationship between the Quote Product Entity and the Order Product Entity.

SELECT    EntityMapId
FROM EntityMapBase
WHERE TargetEntityName='quotedetail' AND SourceEntityName='opportunityproduct'

STEP 2 – Take the output of this SQL Query and insert this into the following URL:


Where [x] is the URL address of the MSCRM Deployment in question and [y] is the GUID Id output of the SQL Query

STEP 3 – This will present the Relationship Mapping screen for mapping attributes from the Opportunity Product entity to the Quote Product entity.

From here, any number of mappings can be added to define how the Products attached to an Opportunity are mapped across when a Quote is added to the Opportunity. (obviously any changes or additional mappings will need to be published in usual MSCRM fashion)

STEP 4 –  Enjoy

The same steps can also be used for controlling how fields are mapped across from Quotes to Orders in a similar fashion.

SELECT    EntityMapId
FROM EntityMapBase
WHERE TargetEntityName='salesorderdetail' AND SourceEntityName='quotedetail'

And similarly how fields are mapped from Order Products to Invoice Products.

SELECT    EntityMapId
FROM EntityMapBase
WHERE TargetEntityName='invoicedetail' AND SourceEntityName='salesorderdetail'

This is a useful technique when working with any custom fields in a Opportunity-Quote-Order process in MSCRM.

Monday, August 2, 2010

How to add images/HTML to Microsoft CRM E-Mail

The Microsoft CRM e-mail templates are HTML and browser-based. As a result, the following requirements must be met to include a graphic in a template:

  • You must be able to display the graphic/Image in a browser. This means that .gif and .jpg graphic formats work best.
  • The e-mail template is an HTML file. Graphics/Images are not “embedded” or attached; rather, only a link is placed in the file pointing to where the actual graphic/Image is located.
  • The graphic/Image must be on a Web site that the e-mail recipient can access.

To add a graphic to an e-mail template:

  1. On the Microsoft CRM Home page, click Settings, click Template Manager, and then click E-mail Templates.
  2. On the Actions bar, click New E-mail Template.
  3. Select a template type and click OK.
  4. Complete the details of the e-mail template.
  5. Open the Web page (using Internet Explorer) or Web site folder (using Windows Explorer) that contains the graphic. Usually all the graphics for a Web site are located in one folder. Links to the graphics in this folder are then placed in the Web files.
  6. Copy and paste the graphic to your e-mail template. Although the graphic will appear, you have copied and pasted only the link to that graphic.
  7. Save the e-mail template.

Now you have the desired email template that could be utilized in your Marketing Campaigns.

Hats off to the beautiful post By Marcello Tonarelli

Thursday, July 29, 2010

First Look at Microsoft Dynamics CRM 2011 codenamed Microsoft Dynamics CRM 5

At the Microsoft WPC conference there was a session called “Taking the Covers Off of Microsoft Dynamics CRM 5”. will be publicly available as a beta release in September 2010 for both online and on-premises deployments. Key Things from the session are :

  1. Microsoft Dynamics CRM 5 is now branded as Microsoft Dynamics CRM 2011.
  2. The key message for CRM 2011 will be the "Power of Productivity"
  3. Microsoft is expanding the global availability of CRM Online now it Will include 8 additional markets 40 markets, 41 languages at the end of 2010.
  4. CRM 2011 will help you manage both customer AND custom relationships.
  5. You can convert an email to Opportunity directly.
  6. CRM 2011 now provides native Outlook access to CRM data (it isn't just an Iframe to the web client like CRM 4.0), benefits include:
    • You can drag columns to reorder, add/remove, use groups, etc.
    • You can toggle the reading pane settings
    • Drag/drop form sections on a personal basis
  7. CRM 2011 allows you to package your customizations into solutions (instead of one giant munged pile of customizations like CRM 4.0):
    • Solutions consist of more than entities, also includes security roles, reports, dashboards, plug-in assemblies, etc.
    • Developers can work with .NET 4.0 framework
    • Can be managed/unmanaged
  8. "processes" (sometimes referred to as scripts or dialogs). This is a huge new feature that a lot of customers ask for in 4.0.
  9. You can now create custom activity types in CRM 2011. Big-time benefit!
  10. CRM 2011 includes field level security! (yeppie… My Favorite)
  11. CRM 2011 will have multiple forms per entity. Yes!!!!!!!!!!

Have a first look in this hour-long exploration of Microsoft Dynamics CRM 5 and see for yourself what all the excitement is about! We dive deep into the new product, discuss strategies for managing upgrades and explore all the opportunities to make the most of this exciting new release. If you’re a long-time Microsoft Dynamics CRM partner, or a BPOS or SharePoint partner looking to engage in the CRM space, this is a session you won’t want to miss.

Speakers: Andy Bybee, Bryan Nielson, Jason Hunt at digitalwpc

Get Microsoft Silverlight

Monday, July 12, 2010

MSCRM 4 - Remove 'Add Existing xxxxx to this record' button

In our CRM implementation where we created several custom entities. It displayed an 'Add Existing xxxxx to this record' button when it was not required and created a lot of confusion among the users. I tried to remove them and like always instead of reinventing the wheel I binged it and then this come to my rescue and within minutes the needful was done. Thanks Dave and 'Dynamic Methods' for this beautiful post. the code that was posted there is :

HideAssociatedViewButtons('new_business_new_surveys', ['Add existing Survey to this record', 'Add a new Survey to this record']);
HideAssociatedViewButtons('new_account_new_eventinvite', ['Add existing Event Invite to this record']);

function HideAssociatedViewButtons(loadAreaId, buttonTitles){
var navElement = document.getElementById('nav_' + loadAreaId);
if (navElement != null) {
navElement.onclick = function LoadAreaOverride() {
// Call the original CRM method to launch the navigation link and create area iFrame
HideViewButtons(document.getElementById(loadAreaId + 'Frame'), buttonTitles);

function HideViewButtons(Iframe, buttonTitles) {
if (Iframe != null ) {
Iframe.onreadystatechange = function HideTitledButtons() {
if (Iframe.readyState == 'complete') {
var iFrame = frames[];
var liElements = iFrame.document.getElementsByTagName('li');

for (var j = 0; j < buttonTitles.length; j++) {
for (var i = 0; i < liElements.length; i++) {
if (liElements[i].getAttribute('title') == buttonTitles[j]) {
liElements[i].style.display = 'none';

Friday, May 14, 2010

When do asynchronous jobs fail, suspend or retry?


Gonzalo Ruiz wrote an excellent article on When do asynchronous jobs fail, suspend or retry? When the CRM Asynchronous Processing Service gets an error, there are three possible actions it will take depending on the type of error:

  • Fail: Job cannot be resumed.
  • Retry: Job will be paused and retried after a period of time.
  • Suspend: Job will be suspended until it is manually resumed.

The entire error handling mechanism is rather complex but I thought of writing down some general rules that will help understanding what the outcome action will be depending on the error that occurs inside the asynchronous job:


Async job

result action


result action

Error code

An SDK call fails: Infinite loop detected



An SDK call fails: Organization disabled


8004A104 / 8004A107

An SDK call fails: Server is busy



An SDK call fails: Other




SQL exception is thrown



Workflow system is paused




Network error



Record associated with workflow cannot be found




The HTTP response fails with code HttpStatusCode.Unauthorized



The HTTP response fails



Plugin or workflow activity throws an InvalidPluginExecutionException



Anything else



Please note that the table above can be used as a general guide but might not cover all scenarios, some exceptions to these actions might apply and it might go outdated in the future.

Why do workflows have a different behavior than other asynchronous jobs when an SDK call fails?

Because the user might be able to fix the problem and resume the workflow. For example, a workflow step sends an email to an account. If the account has no email address, the workflow will suspend with error message "This message cannot be sent to all selected recipients. The e-mail address for one or more recipients is either blank or not a valid e-mail address".

The user can add the email address to the account and resume the workflow. The reason why other asynchronous jobs fail instead is because while workflows are sometimes manipulated by end users, other asynchronous jobs are more oriented towards the system administrator or customizer.

When the result action is Retry, for how long will the job pause before automatically retrying and how much time is there between retries?

The "PostponeUntil" attribute of the asynchronous operation corresponds to the next time it will be retried. The “PostponeUntil” attribute can be retrieved using the SDK. The amount of time to wait until the next retry is calculated considering some deployment settings and grows exponentially on the number of retries. The calculation uses a complex algorithm but these are some default outputs as a function of the RetryCount (the number of times the operation has been retried before):


Time to wait (seconds)











>= 5


Note that by default, any asynchronous operation retrying 5 or more times will be suspended.

When a job has statusreason "Waiting" and statecode "Suspended", how do I know if it will retry or if it is suspended until it is manually resumed?

You can check the "PostponeUntil" attribute of the asynchronous operation to see the time and date in which it will be automatically resumed. If this value is equal to 9999-12-30 23:59:59 (maximum DateTime value) it means that it is waiting to be manually resumed.

How can I retrieve the “PostponeUntil” attribute of the asynchronous operations?

Because the “PostponeUntil” attribute is not available from the entity form or advanced find, you will need to use the SDK to retrieve this value. The following code sample prints the date and time at which each suspended asynchronous job will resume and the number of times it has been retried.

   1: static void Main(string[] args)

   2: {

   3: CrmAuthenticationToken token = new CrmAuthenticationToken();

   4:     token.AuthenticationType = 0;

   5:     token.OrganizationName = "AdventureWorksCycle";

   6:     CrmService service = new CrmService();

   7:     service.Url = "http://crmserver/mscrmservices/2007/crmservice.asmx";

   8:     service.CrmAuthenticationTokenValue = token;

   9:     service.Credentials = System.Net.CredentialCache.DefaultCredentials;


  11:     QueryByAttribute query = new QueryByAttribute();

  12:     query.Attributes = new string[] { "statecode" };

  13:     query.ColumnSet = new ColumnSet(new string[] { "postponeuntil", "retrycount" });

  14:     query.EntityName = EntityName.asyncoperation.ToString();

  15:     query.Values = new object[] { (int)AsyncOperationState.Suspended };

  16:     BusinessEntityCollection bec = svc.RetrieveMultiple(query);

  17:     foreach (BusinessEntity be in bec.BusinessEntities)

  18:     {

  19:         asyncoperation op = (asyncoperation)be;

  20:         string result = String.Format("Operation id={0} PostponeUntil={1} RetryCount={2}",

  21:              op.asyncoperationid.Value,

  22:              op.postponeuntil.UniversalTime,

  23:              op.retrycount.Value);

  24:         Console.WriteLine(result);