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? });
Xrm.Page.data.save().then(function(){ var id = Xrm.Page.data.entity.getId(); }, function(){ alert(“Error”); // not wise but good for testing? });
// 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
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) } }); }
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
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
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.
=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))
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
function getguid() { var accountGUID = Xrm.Page.data.entity.getId(); Xrm.Page.getAttribute(“new_accountguid”).setValue(accountGUID); }