Monday, August 25, 2014

Set Option Set by OptionSet Text

function SetValue(optionsetAttribute, optionText)
 var options = Xrm.Page.getAttribute(optionsetAttribute).getOptions();
 for(i = 0; i < options.length; i++)
  if (options[i].text == optionText)
Calling of the function
SetValue("new_country", "India")

Thursday, July 3, 2014

Using ExecuteMultipleRequest to do bulk operations

Today i came across a nice feature provided in SDK which allows me to do bulk operations in a single call to the server.

For example if i have to create 1000 records within a plugin

The only way was to loop the collection of records and use Service.Create(entity);
This will create 1000 calls to the CRM and is time consuming.

Using ExecuteMultipleRequest you can perform this operation by only sending 1 request to the CRM.
Let see how this can be accomplished

Note: ExecuteMultipleRequest is available in CRM sdk update rollup 12 onwards

In the below example i am deleting 1000 records


ExecuteMultipleRequest BulkDeleteRequest = new ExecuteMultipleRequest()
                    // Assign settings that define execution behavior: continue on error, return responses. 
                    Settings = new ExecuteMultipleSettings()
                        ContinueOnError = false,
                        ReturnResponses = true
                    // Create an empty organization request collection.
                    Requests = new OrganizationRequestCollection()
 foreach (var item in recordstoDelete.Entities)
                    DeleteRequest delRequest = new DeleteRequest() { Target = new EntityReference(item.LogicalName, item.Id) };
                ExecuteMultipleResponse BulkDeleteResponse = (ExecuteMultipleResponse)service.Execute(BulkDeleteRequest);

Run-time limitations

  1. Maximum batch size –1000
  2. Throttling of concurrent calls – for Microsoft Dynamics CRM Online there is a limit of 2 concurrent ExecuteMultipleRequest executions per organization
In one of the blog post from Sonoma partner they claim that the performance is increased by 600%
Here is the link

Sunday, May 18, 2014

Microsoft Dynamics CRM 2013 Marketing Automation

Recently i got a chance to review the book on "Microsoft Dynamics CRM 2013 Marketing Automation".
This book covers the Marketing aspects and the capabilities of Dynamics CRM 2013 and Briefly covers ‪‎coremotives‬ and clickdimensions‬. Click on the link to know more details about the book

Thursday, March 20, 2014

Set Unresolved Email Id's in party List from Java Script

function setUnresolvedRecipient() {
    var unresolvedemail = ""

    if (unresolvedValue != null) {
        var obj = new Object(); //create the unresolved object = unresolvedemail;
        obj.category = 3; = unresolvedemail;
        obj.type = "9206";

        var toField = Xrm.Page.getAttribute("to");
        var toValue = toField.getValue();
        if (toValue != null) {
            toValue.push(obj); //if there are already other values, add to it
        else {
            toField.setValue([obj]); //if 'to' field is null, just override it
        unresolvedField.setValue(null); //wipe the field after adding it to the 'to' list

This will set the email "" in the To party list on the Email Activity

Tuesday, February 4, 2014

Mapping custom fields on the Opportunity product entity to the Quote product in Microsoft Dynamics CRM 2011

Click Below:
Mapping custom fields on the Opportunity product entity to the Quote product in Microsoft Dynamics CRM 2011:

For Online Navigate to
and search for the entity map record and replace the entitymapid