Wednesday, August 29, 2012

MS Crm 2011-Launching a Dialog process when clicking ribbon button

   1.  Create a new  web resource (javascipt) with following code

  function CallDialog(dialogId,typeName,recordId) {
    var url = Xrm.Page.context.getServerUrl();
    recordId=recordId.replace("{", "");

    recordId=recordId.replace("}", "");
    dialogId=dialogId.replace("{", "");

    dialogId=dialogId.replace("}", "");

    url += "/cs/dialog/rundialog.aspx?DialogId=%7b"+dialogId.toUpperCase()+"%7d&EntityName="+typeName+"&ObjectId=%7b"+recordId+'%7d';

2. Create a new dialog process

3.Create a new button using visual ribbon editor and pass parameter  as follows

Function Name:CallDialog
Library: $webresource:<created web resource name>
1. String parameter Value: < Id of dialog process to be launched>
2.String parameter Value: <Entity  name From where dialog will be launched>
3.Crm parameter: FirstPrimaryItemId //to pass record id

No comments:

Post a Comment