Search This Blog

Friday, August 4, 2017

Hide Ribbon button on form using javascript in crm 2015

var deativebtn=top.document.getElementById("button id");
 deativebtn.style.display="none";

Example:
var deativebtn=top.document.getElementById("cms_applicant|NoRelationship|Form|Mscrm.Form.cms_applicant.Deactivate");
deativebtn.style.display="none";

Hide Subgrid Create button from form using javascript in crm 2015

  document.getElementById("subgridname_contextualButtonsContainer").disabled = true;
document.getElementById("subgridname_contextualButtonsContainer").style.display = "none";
document.getElementById("subgridname_contextualButtonsContainer").style.visibility = "hidden";

Wednesday, July 12, 2017

Set Current date and time in feild using Javascript in crm 2015

function settodaydate()
{
var currentDateTime = new Date();
Xrm.Page.getAttribute("fieldname").setValue(currentDateTime);
}

make whole form fields readonly using javascript in CRM 2015

function MarkAllFieldReadOnly() {// this function will make whole form fields readonly

Xrm.Page.ui.controls.forEach(function (control, index) {

try{

control.setDisabled(true);

}

catch (e)

{

}

});

}