Status Change using WebApi

In Dynamics 365, OOTB status field value can be changed in many different ways. Following WebApi can be used to update the Status (statecode + statuscode) as follows. changeStatus = function (executionContext, entityLogicalName, recordId, statecode, statuscode) { // Remove brackets from the GUID if there's any var id = recordId.replace("{", "").replace("}", ""); // Set statecode …

Xrm.Utility : openEntityForm with Parameters

Using "openEntityForm" a CRM form can be opened. While it is opening, different form fields values can be populated and those values can be passed to the form. Xrm.Utility.openEntityForm(name,id,parameters,windowOptions) name: Entity Logical Name id: Record id parameters: Form id, Field Ids, and Values, Custom query string parameters windowOptions: Flag to open as a New Window …

Layered Multi Select Checkboxes – Custom Controls in CRM – Part 2

Layered multi level checkboxes challenge can be acheived by using CRM Optionset control and javascripts too. However there is a technique to be used to identify parent and child levels of the multi layered checkboxes. Each picklist item's value can be used to decide the layer of the checkbox. Control looks like this in the …

Set Server Url to OData Query Dynamically using JavaScripts in CRM 2011 Forms

Following statement can be used to retrieve accounts from the CRM application with the MyOrganization hosted in DevServer. http://DevServer/MyOrganisation/xrmservices/2011/OrganizationData.svc/AccountSet?$select=swmship_FirstName,swmship_Surname&$filter=startswith(Address1_City,'Ca') "http://DevServer/MyOrganisation/" part is varried according to the hosted server and the organization and it might raise errors when the above OData query get executed in some other CRM application. Following JavaScript can be used to get …

Useful Javascripts for CRM 2011

// Get the form type GetFormType: function () { var FORM_TYPE_CREATE = 1; var FORM_TYPE_UPDATE = 2; var FORM_TYPE_READ_ONLY = 3; var FORM_TYPE_DISABLED = 4; var FORM_TYPE_QUICK_CREATE = 5; var FORM_TYPE_BULK_EDIT = 6; var formType = Xrm.Page.ui.getFormType(); if (formType == FORM_TYPE_CREATE) { alert("This record has not yet been created."); } else { alert("This record exists …

Adding a custom button to CRM 2011 Form

Adding a button to a CRM Form is quite challenging as we don't have any IDE to design it. But still it's possible using JavaScript.Here's the JavaScript code for that.// Create the button, using the new_custombutton field as a container        CreateButtonCRM5('swpmt_cancelddi', 'Cancel DDI', '75 px', '16_cancel.png', CustomClickFunction);// Custom Functionfunction CustomClickFunction() {    var response …