Development – CRM Kitchen http://crmkitchen.com Microsoft Dynamic CRM Tue, 25 Oct 2016 14:58:06 +0000 en-US hourly 1 https://wordpress.org/?v=4.6.1 Querying Order By Link Entity with Fetch XML http://crmkitchen.com/querying-order-link-entity-fetch-xml/ http://crmkitchen.com/querying-order-link-entity-fetch-xml/#respond Mon, 26 Sep 2016 09:02:07 +0000 http://crmkitchen.com/?p=345 If you want to sort the results based from linked data, we can add order by link entity’s attribute like this : [crayon-586615a65d59b323142476/]    

The post Querying Order By Link Entity with Fetch XML appeared first on CRM Kitchen.

]]>
If you want to sort the results based from linked data, we can add order by link entity’s attribute like this :

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  <entity name="contact">
    <attribute name="fullname" />
    <attribute name="telephone1" />
    <attribute name="contactid" />
    <link-entity name="contactquotes" from="contactid" to="contactid" visible="false" intersect="true">
      <link-entity name="quote" from="quoteid" to="quoteid" alias="aa">
		<order attribute="createdon" descending="false" />
	  </link-entity>
    </link-entity>
  </entity>
</fetch>

 

 

The post Querying Order By Link Entity with Fetch XML appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/querying-order-link-entity-fetch-xml/feed/ 0
CRM Tips : Javascript Stop Form Saving http://crmkitchen.com/crm-tips-javascript-stop-form-saving/ http://crmkitchen.com/crm-tips-javascript-stop-form-saving/#respond Sun, 02 Aug 2015 13:45:43 +0000 http://crmkitchen.com/?p=217 If you want to control your process on save event, you can use preventDefault method. [crayon-586615a65f431539581903/] Dont forget to click “Pass execution context as first parameter” on Form Properties. preventDefault : Cancels the save operation, but all remaining handlers for the event will still be executed.   Save event arguments (client-side reference) https://msdn.microsoft.com/en-us/library/gg509060.aspx

The post CRM Tips : Javascript Stop Form Saving appeared first on CRM Kitchen.

]]>
If you want to control your process on save event, you can use preventDefault method.

function formOnSave(context) {

    var saveEvt = context.getEventArgs();
    if (Xrm.Page.getAttribute("fieldname").getValue() == null) {
        saveEvt.preventDefault();
    }
}

Dont forget to click “Pass execution context as first parameter” on Form Properties.

crm on save javascript

preventDefault : Cancels the save operation, but all remaining handlers for the event will still be executed.

 

Save event arguments (client-side reference)

https://msdn.microsoft.com/en-us/library/gg509060.aspx

The post CRM Tips : Javascript Stop Form Saving appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/crm-tips-javascript-stop-form-saving/feed/ 0
ExecuteMultipleRequest For Bulk Operation http://crmkitchen.com/executemultiplerequest-bulk-operation/ http://crmkitchen.com/executemultiplerequest-bulk-operation/#respond Sat, 01 Aug 2015 19:45:21 +0000 http://crmkitchen.com/?p=213 You can use the ExecuteMultipleRequest message to support higher throughput bulk message passing scenarios in Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online 2015 Update, particularly in the case of Microsoft Dynamics CRM Online where Internet latency can be the largest limiting factor. ExecuteMultipleRequest accepts an input collection of message Requests, executes each of […]

The post ExecuteMultipleRequest For Bulk Operation appeared first on CRM Kitchen.

]]>
You can use the ExecuteMultipleRequest message to support higher throughput bulk message passing scenarios in Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online 2015 Update, particularly in the case of Microsoft Dynamics CRM Online where Internet latency can be the largest limiting factor. ExecuteMultipleRequest accepts an input collection of message Requests, executes each of the message requests in the order they appear in the input collection, and optionally returns a collection of Responses containing each message’s response or the error that occurred. Each message request in the input collection is processed in a separate database transaction.ExecuteMultipleRequest is executed by using the IOrganizationService.Execute method.

  • For Online CRM, maximum Batch Size is 1000. So, for Online CRM, maximum 1000 requests can be executed at a time.
  • For On Premise, Batch Size can be increased.

 

// Create an ExecuteMultipleRequest object.
    requestWithResults = 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()
    };

    // Create several (local, in memory) entities in a collection. 
    EntityCollection input = GetCollectionOfEntitiesToCreate();

    // Add a CreateRequest for each entity to the request collection.
    foreach (var entity in input.Entities)
    {
        CreateRequest createRequest = new CreateRequest { Target = entity };
        requestWithResults.Requests.Add(createRequest);
    }

    // Execute all the requests in the request collection using a single web method call.
    ExecuteMultipleResponse responseWithResults =
        (ExecuteMultipleResponse)_serviceProxy.Execute(requestWithResults);

    // Display the results returned in the responses.
    foreach (var responseItem in responseWithResults.Responses)
    {
        // A valid response.
        if (responseItem.Response != null)
            DisplayResponse(requestWithResults.Requests[responseItem.RequestIndex], responseItem.Response);

        // An error has occurred.
        else if (responseItem.Fault != null)
            DisplayFault(requestWithResults.Requests[responseItem.RequestIndex], 
                responseItem.RequestIndex, responseItem.Fault);
    }

 

 

Here is another example of changing the State and Status of records by ExecuteMultipleRequest.

for (int i = 0; i < records.Entities.Count; i++)
{
    SetStateRequest setStateReq = new SetStateRequest();
    setStateReq.EntityMoniker = new EntityReference();
    setStateReq.EntityMoniker.Id = records.Entities[i].Id;
    setStateReq.EntityMoniker.LogicalName = records.Entities[i].LogicalName;
    setStateReq.State = new OptionSetValue(0);
    setStateReq.Status = new OptionSetValue(1);
    req.Requests.Add(setStateReq);
}
 
var res = service.Execute(req) as ExecuteMultipleResponse;

 

More info : https://msdn.microsoft.com/en-us/library/jj863631.aspx

The post ExecuteMultipleRequest For Bulk Operation appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/executemultiplerequest-bulk-operation/feed/ 0
Trigger a Workflow on CRM 2015 using C# http://crmkitchen.com/trigger-workflow-crm-2015-using-c/ http://crmkitchen.com/trigger-workflow-crm-2015-using-c/#respond Thu, 09 Jul 2015 20:24:39 +0000 http://crmkitchen.com/?p=179 If you want to run/trigger a workflow, you can execute a workflow programmatically with following request : [crayon-586615a66966c056421760/] Also this request is supported by Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online 2015 Update. Source : https://msdn.microsoft.com/en-us/library/gg309600.aspx

The post Trigger a Workflow on CRM 2015 using C# appeared first on CRM Kitchen.

]]>
If you want to run/trigger a workflow, you can execute a workflow programmatically with following request :

// Create an ExecuteWorkflow request.
ExecuteWorkflowRequest request = new ExecuteWorkflowRequest()
           {
             WorkflowId = _workflowId,
             EntityId = _leadId
           }; 
// Execute the workflow.
ExecuteWorkflowResponse response = 
(ExecuteWorkflowResponse)_serviceProxy.Execute(request);

Also this request is supported by Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online 2015 Update.

Source : https://msdn.microsoft.com/en-us/library/gg309600.aspx

The post Trigger a Workflow on CRM 2015 using C# appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/trigger-workflow-crm-2015-using-c/feed/ 0
Save the form with Callback functions on CRM 2015 http://crmkitchen.com/save-form-callback-function-crm-2015/ http://crmkitchen.com/save-form-callback-function-crm-2015/#respond Thu, 09 Jul 2015 20:05:03 +0000 http://crmkitchen.com/?p=188 [crayon-586615a669aa0931958577/] Saves the record asynchronously with the option to set callback functions to be executed after the save operation is completed. With Microsoft Dynamics CRM Online 2015 Update 1 or later you can also set an object to control how appointment, recurring appointment, or service activity records are processed. Open different or same entity form […]

The post Save the form with Callback functions on CRM 2015 appeared first on CRM Kitchen.

]]>

Xrm.Page.data.save(saveOptions).then(successCallback, errorCallback)

Saves the record asynchronously with the option to set callback functions to be executed after the save operation is completed.

crm-2013-client-api

With Microsoft Dynamics CRM Online 2015 Update 1 or later you can also set an object to control how appointment, recurring appointment, or service activity records are processed.

Open different or same entity form after save :

Xrm.Page.data.save().then(
    function() {
       console.log("success");
       Xrm.Utility.openEntityForm(entityname,recordId);
    },
    function(errorCode,message) {
       console.log(message);
    }
);

Reload form after save

Xrm.Page.data.save().then(
    function() {
      //save worked...
      Xrm.Page.data.refresh();
    },
    function() {
      console.log("save failed");
    }
);

window.location.reload(true); or location.reload(); or window.location = document.url;

These scripts cannot work for CRM 2013 and higher version. So you have to use callback functions after saving.

Source : https://msdn.microsoft.com/en-us/library/dn481607.aspx

The post Save the form with Callback functions on CRM 2015 appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/save-form-callback-function-crm-2015/feed/ 0
How to get the type of attribute on CRM using Javascript ? http://crmkitchen.com/get-type-attribute-crm-using-javascript/ http://crmkitchen.com/get-type-attribute-crm-using-javascript/#respond Thu, 09 Jul 2015 19:48:04 +0000 http://crmkitchen.com/?p=190 getAttributeType Returns a string value that represents the type of attribute. [crayon-586615a66c63a555149051/] This method will return one of the following string values: boolean datetime decimal double integer lookup memo money optionset string getFormat Returns a string value that represents formatting options for the attribute. This method will return one of the following string values or […]

The post How to get the type of attribute on CRM using Javascript ? appeared first on CRM Kitchen.

]]>
getAttributeType

Returns a string value that represents the type of attribute.

Xrm.Page.getAttribute(fieldname).getAttributeType();

This method will return one of the following string values:

  • boolean
  • datetime
  • decimal
  • double
  • integer
  • lookup
  • memo
  • money
  • optionset
  • string

getFormat

Returns a string value that represents formatting options for the attribute.

This method will return one of the following string values or null:

  • date
  • datetime
  • duration
  • email
  • language
  • none
  • phone
  • text
  • textarea
  • tickersymbol
  • timezone
  • url

 

Application Field Type Format Option Attribute Type Format Value
Date and Time Date Only datetime date
Date and Time Date and Time datetime datetime
Whole Number Duration integer duration
Single Line of Text E-mail string email
Whole Number Language optionset language
Whole Number None integer none
Single Line of Text Text Area string textarea
Single Line of Text Text string text
Single Line of Text Ticker Symbol string tickersymbol
Single Line of Text Phone string phone
Whole Number Time Zone optionset timezone
Single Line of Text Url string url

Source : https://msdn.microsoft.com/en-us/library/gg334409.aspx#BKMK_getAttributeType

The post How to get the type of attribute on CRM using Javascript ? appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/get-type-attribute-crm-using-javascript/feed/ 0
Microsoft Dynamics CRM 2015 Resources for CRM Developers http://crmkitchen.com/microsoft-dynamics-crm-2015-resources-crm-developers/ http://crmkitchen.com/microsoft-dynamics-crm-2015-resources-crm-developers/#comments Sat, 04 Jul 2015 13:00:56 +0000 http://crmkitchen.com/?p=134 You can find the most used resources in this post. There are also more resource if you know please specify in comments. Also you can find all resources on Guido Preite’s blog for all version. Microsoft Dynamics CRM 2015 Software Development Kit (CRM 2015 SDK) Download link: http://www.microsoft.com/en-us/download/details.aspx?id=44567 CRM Help & Training https://www.microsoft.com/en-US/dynamics/crm-customer-center/ CRM eBooks and […]

The post Microsoft Dynamics CRM 2015 Resources for CRM Developers appeared first on CRM Kitchen.

]]>
You can find the most used resources in this post. There are also more resource if you know please specify in comments.

Also you can find all resources on Guido Preite’s blog for all version.

Microsoft Dynamics CRM 2015 Software Development Kit (CRM 2015 SDK)

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=44567

CRM Help & Training

https://www.microsoft.com/en-US/dynamics/crm-customer-center/

CRM eBooks and Videos

https://www.microsoft.com/en-US/dynamics/crm-customer-center/ebooks-and-videos.aspx

Microsoft Dynamics CRM 2015 Update 1 (KB 3056327)

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=46908

Microsoft Dynamics CRM 2015 Update 0.1 (KB 3010990)

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=46552

Microsoft Dynamics CRM 2015 for Microsoft Office Outlook (Outlook Client)

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=45015

XrmToolbox for Dynamics CRM 2013/2015

http://www.xrmtoolbox.com/

Microsoft System Center Management Pack for Dynamics CRM 2015

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=46371

Microsoft Dynamics CRM 2015 E-mail Router

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=45017

Microsoft Dynamics CRM 2015 Custom Code Validation Tool

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=45535

Windows Identity Foundation for Windows 7, 2008, 2008 R2, and Vista

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=17331

Microsoft Dynamics Marketing SDK

Download link: https://www.microsoft.com/en-us/download/details.aspx?id=45023

Microsoft Dynamics Marketing 2015 Resources

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=43108

Microsoft Dynamics CRM 2015 Report Authoring Extension (CRM 2015 BIDS)

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=45013

Microsoft Dynamics CRM 2015 List Component for Microsoft SharePoint Server 2010
and Microsoft SharePoint Server 2013 (for multiple browsers)

Download link: http://www.microsoft.com/en-us/download/details.aspx?id=45018

Compatibility with Microsoft Dynamics CRM 2015

https://support.microsoft.com/en-us/kb/3018360

The post Microsoft Dynamics CRM 2015 Resources for CRM Developers appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/microsoft-dynamics-crm-2015-resources-crm-developers/feed/ 3
CRM 2015 .NET Framework 4.5.2 Version http://crmkitchen.com/crm-2015-net-framework-4-5-2-version/ http://crmkitchen.com/crm-2015-net-framework-4-5-2-version/#respond Sat, 04 Jul 2015 12:46:55 +0000 http://crmkitchen.com/?p=114 The type or namespace name ‘Xrm’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)   You have to change .NET Framework version in your projects, if you use CRM 2015 If you say “.NET Framework 4.5.2 not showing in Visual Studio” or “How to select .NET 4.5.2 as a target […]

The post CRM 2015 .NET Framework 4.5.2 Version appeared first on CRM Kitchen.

]]>

The type or namespace name ‘Xrm’ does not exist in the namespace ‘Microsoft’ (are you missing an assembly reference?)

 

You have to change .NET Framework version in your projects, if you use CRM 2015

If you say “.NET Framework 4.5.2 not showing in Visual Studio” or “How to select .NET 4.5.2 as a target framework in Visual Studio ? “, follow the links below.

NET Framework 4 5 2 Visual Studio

You can find some helpful links about that :

Compatibility with Microsoft Dynamics CRM 2015

https://support.microsoft.com/en-us/kb/3018360

Microsoft.Xrm.Sdk version : 7.0.0.0

CRM 2015 Framework Compability

Download .NET Framework 4.5.2 Developer Pack

https://www.microsoft.com/en-us/download/details.aspx?id=42637

This pack contains the following components :

  • .NET Framework 4.5.2
  • .NET Framework 4.5.2 Multi-Targeting Pack: Contains the reference assemblies needed to build apps that target the .NET Framework 4.5.2
  • .NET Framework 4.5.2 Language Packs
  • .NET Framework 4.5.2 Multi-Targeting Pack Language Packs: Contains the IntelliSense files to display help while building apps that target the .NET Framework 4.5.2 through Visual Studio and third party IDEs.

Visual Studio and .NET Framework

https://msdn.microsoft.com/en-us/library/dn481609.aspx

Moving to the .NET Framework 4.5.2

http://blogs.msdn.com/b/dotnet/archive/2014/08/07/moving-to-the-net-framework-4-5-2.aspx

 

 

The post CRM 2015 .NET Framework 4.5.2 Version appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/crm-2015-net-framework-4-5-2-version/feed/ 0
CRM Online 2015 Debugging http://crmkitchen.com/crm-2015-online-debugging/ http://crmkitchen.com/crm-2015-online-debugging/#respond Sat, 04 Jul 2015 11:54:41 +0000 http://crmkitchen.com/?p=108 How to Debug CRM Online 2015 Plugin ? We use Plugin Registration Tool for deployment and debugging because there is no CRM Developer Toolkit for CRM 2015. If you dont find this tool you can download latest CRM 2015 SDK. Follow the steps to debug plugins registered for online version. Connect to Microsoft Dynamics CRM […]

The post CRM Online 2015 Debugging appeared first on CRM Kitchen.

]]>
How to Debug CRM Online 2015 Plugin ?

We use Plugin Registration Tool for deployment and debugging because there is no CRM Developer Toolkit for CRM 2015. If you dont find this tool you can download latest CRM 2015 SDK. Follow the steps to debug plugins registered for online version.

Connect to Microsoft Dynamics CRM Online 2015 Server

CRM Online 2015 Debugging

 

Install Profiler in the Plugin Registration Tool

CRM 2015 Online Debugging

Select a Plugin step and click Start Profiling

CRM Online 2015 Debugging

Perform the operation which trigger the plugin in CRM

Here creation of Account which trigger the plugin.

Click Download Log File and Save this file

CRM Online 2015 Debugging

The Plugin throws an exception and Business Process Dialog is displayed, click Download Log File and save this file.

Click Debug in the Plugin Registration Tool

Now debug dialog will open and select the file you downloaded ErrorDetails.txt for Profile Location. Then select the Plugin assembly dll where dll and pdb files available to debug.

CRM Online 2015 Debugging

Attach the PluginRegistration.exe process in Visual Studio

Open the plugin solution in Visual Studio and then place the break point to debug, attach the debugger to PluginRegistration.exe process.

CRM Online 2015 Debugging

Click Start Execution in the Plugin Registration Tool’s Dialog

CRM Online 2015 Debugging

Now Debugger will start debugging from the break point in the Visual Studio.

CRM Online 2015 Debugging

 

 

Also I recommend you to read these posts and video :

I reviewed the article by Guru Prasad which was really helpful in getting this article together.

The post CRM Online 2015 Debugging appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/crm-2015-online-debugging/feed/ 0
Dynamics CRM 2013 Developer Toolkit for Visual Studio 2013 http://crmkitchen.com/dynamics-crm-2013-developer-toolkit-visual-studio-2013/ http://crmkitchen.com/dynamics-crm-2013-developer-toolkit-visual-studio-2013/#respond Tue, 30 Jun 2015 15:14:50 +0000 http://crmkitchen.com/?p=85   Normally there is no CRM Developer Toolkit installation file for Visual Studio 2013. But you can install it with some customization. Firstly Download the installation files. Open Visual Studio folder and Run Microsoft.CrmDeveloperTools.vsix file Run the crmSDKFix.reg file Copy contents of the CRM MSBuild folder to “C:\Program Files\MSBuild\Microsoft\CRM” or “C:\Program Files (x86)\MSBuild\Microsoft\CRM” If there is no CRM […]

The post Dynamics CRM 2013 Developer Toolkit for Visual Studio 2013 appeared first on CRM Kitchen.

]]>
 

Normally there is no CRM Developer Toolkit installation file for Visual Studio 2013. But you can install it with some customization.

s2

  • Firstly Download the installation files.
  • Open Visual Studio folder and Run Microsoft.CrmDeveloperTools.vsix file
  • s3
  • Run the crmSDKFix.reg file
  • Copy contents of the CRM MSBuild folder to “C:\Program Files\MSBuild\Microsoft\CRM” or “C:\Program Files (x86)\MSBuild\Microsoft\CRM”
  • If there is no CRM folder in MSBuild folder, you can create this CRM folder.
  • Now open Visual Studio and you can create CRM Toolkit Project.

The post Dynamics CRM 2013 Developer Toolkit for Visual Studio 2013 appeared first on CRM Kitchen.

]]>
http://crmkitchen.com/dynamics-crm-2013-developer-toolkit-visual-studio-2013/feed/ 0