Blog

Tel. 01489 666383

Retrieve the GUID of an Entity record

Xrm.Page.data.save().then(function(){ var id = Xrm.Page.data.entity.getId(); }, function(){ alert(“Error”); // not wise but good for testing? });


4th April 2018 0

enable / disable section/tab/form v9+

// Section Disable function sectiondisable (sectionname, disablestatus) { var ctrlName = Xrm.Page.ui.controls.get(); for(var i in ctrlName) { var ctrl = ctrlName[i]; var ctrlSection = ctrl.getParent().getName(); if (ctrlSection == sectionname) { ctrl.setDisabled(disablestatus); } } } // sectiondisable   // TAB Disable function tabdisable (tabname, disablestatus) { var tab = Xrm.Page.ui.tabs.get(tabname); if (tab == null) alert(“Error: The…
Read more


14th March 2018 0

Enable / Disable a field in Dynamics

Xrm.Page.getControl(“fieldname”).setDisabled(false);


14th March 2018 0

lock all fields on a form based on field choice

function setupForm(){ if (Xrm.Page.ui.getFormType() == 2 && Xrm.Page.getAttribute(“new_lockdown”).getValue() == true) { setFieldReadOnly(true); } } function setFieldReadOnly(){ Xrm.Page.data.entity.attributes.forEach(function (attribute, index) { var control = Xrm.Page.getControl(attribute.getName()); if (control) { control.setDisabled(true) } }); }


22nd February 2018 0

Showing current year/month by default in a SharePoint list field

use the following formula: =TEXT(Today,”MMMM”) for long month e.g. January =TEXT(Today,”MM”) for month number e.g 01 =TEXT(Today,”YYYY”) for year e.g. 2017


9th February 2018 0

Dynamics SharePoint Integration: A list of files from the following document locations could not be retrieved

This can occur when the sort field in the SharePoint Document | Document Associated Grid view is set to something other than PATH. In Dynamics, Under SETTINGS | CUSTOMIZATIONS | CUSTOMIZE THE SYSTEM | ENTITIES | SHAREPOINT DOCUMENT | VIEWS | DOCUMENT ASSOCIATED VIEW | CONFIGURE SORTING | SORT BY – set to PATH


9th February 2018 0

Using CSS with Dynamics

Step 1.  Create a CSS web resource Step 2.  Create a Javascript library  and then assign to the form onload event eg. the Account entity form.    


9th February 2018 0

SharePoint – calculate the number of days between dates exclude weekends

=IF(ISERROR(DATEDIF([Start Time],[End Time],”d”)),””,(DATEDIF([Start Time],[End Time],”d”))+1-INT(DATEDIF([Start Time],[End Time],”d”)/7)*2-IF((WEEKDAY([End Time])-WEEKDAY([Start Time]))<0,2,0)-IF(OR(AND(WEEKDAY([End Time])=7,WEEKDAY([Start Time])=7),AND(WEEKDAY([End Time])=1,WEEKDAY([Start Time])=1)),1,0)-IF(AND(WEEKDAY([Start Time])=1,(WEEKDAY([End Time])-WEEKDAY([Start Time]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Time])=7),WEEKDAY([End Time])=7),1,0))


9th February 2018 0

hide tab in dynamics

function hidetab () { if (Xrm.Page.context.client.getClient() != “Mobile”)  // ignore if mobile { // Add code that should not run in CRM for phones and tablets here if (Xrm.Page.getAttribute(“new_fieldname”).getValue() != null) { switch (Xrm.Page.getAttribute(“new_fieldname”).getText()) { case “Straight”: hideTab(“Straight”,true); hideTab(“Curved”,false); break; case “Curved”: hideTab(“Straight”,false); hideTab(“Curved”,false); break; default: hideTab(“Straight”,false); hideTab(“Curved”,false); break; } } } } function hideTab…
Read more


9th February 2018 0

Get the GUID in Dynamics – Javascript

function getguid() { var accountGUID = Xrm.Page.data.entity.getId(); Xrm.Page.getAttribute(“new_accountguid”).setValue(accountGUID); }


9th February 2018 0