Search This Blog

Showing posts with label button. Show all posts
Showing posts with label button. Show all posts

Thursday, January 2, 2014

To disable and enable ribbon button on change of Field Value using ribbon editor

Follow those steps:
1.      Click on the button
2.      Expand command
3.      Right click on command and select edit enable rule.
4.      Then click on the rule and press edit button.
5.      Write the field physical name in field section
6.      And also give invert (true or false) as your condition.
7.      In value section write the value on the basis of which button enable or disable.


Below Video is good :

http://www.youtube.com/watch?v=OE1CVePTeTc

Disable Lead Ribbon button using javascript in CRM 2011 and 2013

var x= top.document.getElementById("lead|NoRelationship|Form|Mscrm.Form.lead.ConvertLeadQuick-Large");
x.disabled = true;

Run dialogue by clicking Button

function project_code()//project code button
{
var dialogId = "{E8F6C5EC-E606-447E-B253-C950FB6F29B2}"; // dialogue id
var typeName = "salesorder";
var recordId = Xrm.Page.data.entity.getId();
LaunchModalDialog(dialogId,typeName,recordId);
//alert("project code");
}

function project_manager()//project manager button
{
var dialogId = "{6322F944-7202-4EDF-81A0-3EFAB678068D}"; // dialogue id
var typeName = "salesorder";
var recordId = Xrm.Page.data.entity.getId();
LaunchModalDialog(dialogId,typeName,recordId);
//alert("project manager");
}
//**This function will run buttons and dialogs working on these button**//
function LaunchModalDialog(dialogId,typeName,recordId)
{
    var serverUrl = Xrm.Page.context.getServerUrl();
    recordId=recordId.replace("{", "");
    recordId=recordId.replace("}", "");
   
    dialogId=dialogId.replace("{", "");
    dialogId=dialogId.replace("}", "");
   
   //var project_code_id = {E8F6C5EC-E606-447E-B253-C950FB6F29B2};
   //var project_manager_id = {6322F944-7202-4EDF-81A0-3EFAB678068D};

   var serverUri = serverUrl +'/cs/dialog/rundialog.aspx';
   var mypath =  serverUri +'?DialogId=%7b' +dialogId.toUpperCase()  +'%7d&EntityName=' + typeName+'&ObjectId=%7b' +recordId+'%7d';
 
   //var mypath =  serverUri +'?DialogId=%7b' +project_code_id.toUpperCase()  +'%7d&EntityName=' + typeName+'&ObjectId=%7b' +recordId+'%7d';
   // First item from selected contacts only
   window.showModalDialog(mypath);
 
   // Reload form.
   window.location.reload(true);
}