Difference between Secure / Unsecure Configuration of Plugin Registration tool in CRM 2011

Difference between Secure / Unsecure Configuration of Plugin Registration tool in CRM 2011

Unsecure Configuration of
Plugin Registration tool in CRM 2011
Secure Configuration of Plugin
Registration tool in CRM 2011
Unsecure configuration information could be read by any user in CRM. Remember its public information (Eg: Parameter strings to be used in plugin could be supplied here)
The Secure Configuration information could be read only by CRM Administrators.(Eg: Restricted data from normal user could be supplied here)
Imagine that you include a plugin, plugin steps and activate them in a solution. Later solution was exported as Managed Solution to another environment. In this scenario, the supplied Unsecure configuration values would be available in the new environment.
Imagine that you include a plugin,plugin steps and activate them in asolution. Later solution was exportedas Managed Solution to anotherenvironment. In this scenario, thesupplied Secure configuration  information would NOTbe available in the new environment. The simple  reason behind this is to provide more security to the contents of Secure Configuration.

Note: If you supply parameter strings under secure configuration then the plugin will work fine only for the CRMIf you supply any parameter strings to Plugin and read by all of the users in CRM , use Unsecure Configuration. If

Consider a scenario that you have developed a plugin and certain parameter strings are designed to supply to the plugin in such a way that it is required to run the plugin smoothly.If you supply these parameter strings under secure configuration then the plugin will work fine only for the CRM Administrators. The simple reason is secure configuration can only be read by a CRM Administrator. So if the user is not a CRM administrator then the plugin would try to read  but it would fail just because its under the secure configuration.All public information should be supplied via Unsecure configuration section. So please remember these tips when you supply the secure and unsecure configuration via Plugin Registration tool.

Cheers,

Advertisements

Disable / Enable fields, sections, tabs and the whole Form in MS CRM 2011

Disable/Enable fields, sections, tabs and the whole Form in MS CRM 2011

When working with the MS CRM form , Your requirement will be to enable (set to read/write) or disable (set to read / only) selected fields, sections, tabs and the Whole form.

Please have a glance below code for these functionalities to work out.

1)     Enable / Disable a field

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

2)    Enable / Disable a Section

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

3)    Enable / Disable a Tab

function tabdisable (tabname, disablestatus)
{
 var tab = Xrm.Page.ui.tabs.get(tabname);
 if (tab == null) alert("Error: The tab: " + tabname + " is not on the form");
 else {
     var tabsections =  tab.sections.get();
     for (var i in tabsections) {
         var secname = tabsections[i].getName();
         sectiondisable(secname, disablestatus);
     }
  }
}   // tabdisable

 

4)    Enable / Disable a Form

function formdisable(disablestatus)
{
    var allAttributes = Xrm.Page.data.entity.attributes.get();
    for (var i in allAttributes) {
           var myattribute = Xrm.Page.data.entity.attributes.get(allAttributes[i].getName());
           var myname = myattribute.getName();          
           Xrm.Page.getControl(myname).setDisabled(disablestatus); 
    }
} // formdisable

5)     Enable / Disable All Controls in the TAB

function DisableAllControlsInTab(tabControlNo) 
{  
var tabControl = Xrm.Page.ui.tabs.get(tabControlNo);
    if (tabControl != null) 
{    
      Xrm.Page.ui.controls.forEach
( 
     function (control, index) 
{          
if (control.getParent().getParent() == tabControl && control.getControlType() != "subgrid") 
{              control.setDisabled(true);  
        }      
});
      } 
 }
function EnableAllControlsInTab(tabControlNo)
 {      
var tabControl = Xrm.Page.ui.tabs.get(tabControlNo);      
if (tabControl != null) 
{         
 Xrm.Page.ui.controls.forEach
(      
function (control, index) 
{          
if (control.getParent().getParent() == tabControl && control.getControlType() != "subgrid") 
{              
control.setDisabled(false);  
        }  
    });  
    } 
 }

 Hope this will help.

Regards,

Display a Reports in a Dashboard –MS Dynamics CRM 2011

Display a Reports in a Dashboard –MS Dynamics CRM 2011

Sometimes there may be a scenario to show our Reports in Dashboard Area of MS CRM . To achieve this please follow the below procedure.

1. Run the report you want to display in a Dashboard.

2. Press F11 Copy the URL that displays in address bar

3. Create a New Dashboard.  Choose any layout that fits in your requirement

4. Insert an IFRAME in the Dashboard.

5.  Paste the above Url after making the following adjustments to it:

  • Remove “http://servername/orgname” . This will make your url relative.
  • Replace “?action=filter” with “?action=run” This will bypass the first step before running the report where CRM asks for some parameters.

for instance, if the original url was:

http://Servername/OrgName/crmreports/viewer/viewer.aspx?action=filter&helpID=My%3f_gridType%3d10004%26etc%3d10004%26id%3d%257..then, you should write:

/crmreports/viewer/viewer.aspx?action=run&helpID=My%3f_gridType%3d10004%26etc%3d10004%26id%3d%257

6. Also, clear checkbox ‘Restrict cross-frame scripting’

img2

7. Use the buttons ‘Increase Width’ and ‘Increase Height’ so as to make the IFRAME fill the whole page of your Dashboard (or just the space it’s supposed to need).

Img3

8. Save & Close the Dashboard.

9. Publish the Dashboard.

10. If you want to change the layout depending upon your requirement.

Hope this will help you

Regards,

Change The Tab Order On Microsoft CRM Forms

Change The Tab Order On Microsoft CRM Forms

By Default CRM Form moves the tab order from “Top to Bottom “ . In some scenarios the user want to move Tab order from “Left to Right” , have to place the below Java Script code for the desired functionality. But its unsupported way of Customization.

function ChangeTabOrder()

{      ReArangeTabIndex(); }

function ReArangeTabIndex()

{

    for( var i = 0 ; i < crmForm.all.length ; i++ )

    {

          if( crmForm.all[ i ].tabIndex )

              crmForm.all[ i ].tabIndex = 1000 + (i*10);

    } }

Call the ChangeTabOrder() function in Onload event of the CRM Form.

Hope this will help you.

Regards,

Check User is A Part of Team in MS CRM 2011 using ODATA JavaScript

Check User is A Part of Team in MS CRM 2011 using ODATA JavaScript

function team() {

var teamId = Xrm.Page.data.entity.attributes.get(“new_teamid”).getValue()[0].id;

var userId = Xrm.Page.context.getUserId();

if (teamId != null) {

var fwdFilter = “TeamMembershipSet?$filter=TeamId eq guid'”+teamId+”‘ and SystemUserId eq guid'”+userId+”‘”;

var fwdResult = ODataRetrieveMultiple(fwdFilter);

if (fwdResult != null)
{
alert(“User is part of This Team”);

}
else
{
alert(“User is not part of This Team”);
}

}

}
function ODataRetrieveMultiple(fwdFilter) {
var serverUrl = Xrm.Page.context.getServerUrl();

var oDataEndpointUrl = serverUrl + “/XRMServices/2011/OrganizationData.svc/”;

oDataEndpointUrl += fwdFilter;

var service = GetRequestObject();

if (service != null) {

service.open(“GET”, oDataEndpointUrl, false);

service.setRequestHeader(“X-Requested-Width”, “XMLHttpRequest”);

service.setRequestHeader(“Accept”, “application/json, text/javascript, */*”);

service.send(null);

var requestResults = eval(‘(‘ + service.responseText + ‘)’).d;

if (requestResults != null && requestResults.results.length > 0) {

return requestResults.results;

}

}

return null;

}

function GetRequestObject() {

if (window.XMLHttpRequest) {

return new window.XMLHttpRequest;

}

else {

try {

return new ActiveXObject(“MSXML2.XMLHTTP.3.0”);

}

catch (ex) {

return null;

}

}

}

 

Note: While you copy the code and paste in your form the punctuations are not recognized by JavaScript API . So need to replace the symbols like ” , ‘ * & for avoiding errors.

Cheers,

Hope This Code Help !!!

Set Field Values Using Parameters Passed to a Form

Set Field Values Using Parameters Passed to a Form

[Applies to: Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online] 

The content in this topic can be used for Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online. You can set default values for new records created by users by specifying attribute values in the URL that is used to open the form. By default, these values are set in the form, but can be changed by users before they save the record.

In This Topic

Passing Parameters to Set Field Record Values

noteNote
See the technical article Use the Form Query String Parameter Tool to Demonstrate Setting Default Field Values in New Record Forms. This article includes a link to a managed solution you can install and use to generate a URL to set values in the form. 

For all Microsoft Dynamics CRM Online organizations and Microsoft Dynamics CRM 2011 on-premises organizations that have Microsoft Dynamics CRM 2011 Update Rollup 8 installed, there is an easier way to pass parameters. For these organizations, you can pass parameter values to the form to set field values using the Xrm.Utility.openEntityForm function. For an example, see Example: Use Xrm.Utility.openEntityForm to Open a New Window

 

When you open a new form by using the URL address, you can include arguments in the extraqs parameter to set field values. The following requirements must be met:

  • You must encode the parameters passed in the extraqs parameter. To encode the parameters, useencodeURIComponent.
  • The names of the query string arguments must match or include the names of attributes for the entity.
  • The values passed must be valid.
  • The value cannot be a script.

Any attempt to pass an invalid parameter or value will result in an error.

  • For Boolean fields, use either an integer value of 0 or 1, or a text value of true or false to set the value.
  • For DateTime fields, use the text value of the date.

Example: Set the Value for String Fields

The following sample sets the value for the Name field of a new account record to “New Account”.

The unencoded value for the extraqs parameter is “name=New Account”.

/main.aspx?etn=account&extraqs=name%3DNew%20Account&pagetype=entityrecord

Setting Values for Lookup fields

The following table describes five types of lookup fields. For examples using lookup fields, see Example: Set the Value for Lookup Fields and Example: Use Xrm.Utility.openEntityForm to Open a New Window.

Lookup Type Description
simple lookup Allows for a single reference to one type of entity.
customer lookup Allows for a single reference to either an account or a contact record.
owner lookup Allows for a single reference to either a team or a system user record.
partylist lookup Allows for multiple references to multiple entities.
regarding lookup Allows for a single reference to multiple entities.

The following guidelines apply when setting the value of a lookup on a form using a query string argument:

  • For simple lookups you must set the value and the text to display in the lookup. Use the suffix “name” with the name of the attribute to set the value for the text.

    Do not use any other arguments.

  • For customer and owner lookups you must set the value and the name in the same way you set them for simple lookups. In addition you must use the suffix “type” to specify the type of entity. Allowable values are account, contact, systemuser, and team.
  • You cannot set the values for partylist or regarding lookups.

Example: Set the Value for Lookup Fields

To set values for lookup fields, use the data value, the name value, and for customer or owner lookups only, specify the type value for the respective field. The following sample sets the owner field to a user named “Mark Folkerts”.

The unencoded value for the extraqs parameter is “ownerid={B8C6E040-656E-DF11-B414-00155DB1891A}&owneridname=Mark Folkerts&owneridtype=systemuser”.

/main.aspx?etn=lead&pagetype=entityrecord&extraqs=ownerid%3D%7bB8C6E040-656E-DF11-B414-00155DB1891A%7d%26owneridname%3DMark%20Folkerts%26owneridtype%3Dsystemuser

Example: Set the Value for Date Fields

The following sample sets the Est. Close Date field for a new opportunity to January 31, 2011. The unencoded value for theextraqs parameter is ‘estimatedclosedate=01/31/11’.

/main.aspx?etn=opportunity&extraqs=estimatedclosedate%3D01%2F31%2F11&pagetype=entityrecord

Example: Set the Value for Option Set Fields

To set the value for an Option set field, set the integer value for the option. The following sample sets the Role field value to “Decision Maker” in a new contact record.

The unencoded value for the extraqs parameter is “accountrolecode=1”.

/main.aspx?etn=contact&extraqs=accountrolecode%3D1&pagetype=entityrecord

Example: Use window.open to Open a New Window

The following sample sets default values on several different fields and shows how to use encodeURIComponent to encode the value of the extraqs parameter. If you use the window.open method, you can control the features of the window that is opened.

function OpenNewContact() {
    //Set the Parent Customer field value to “Contoso”.
    var extraqs = "parentcustomerid={F01F3F6D-896E-DF11-B414-00155DB1891A}";
    extraqs += "&parentcustomeridname=Contoso";
    extraqs += "&parentcustomeridtype=account";
    //Set the Address Type to “Primary”.
    extraqs += "&address1_addresstypecode=3";
    //Set text in the Description field.
    extraqs += "&description=Default values for this record were set programatically.";
    //Set Do not allow E-mails to "Do Not Allow".
    extraqs += "&donotemail=1";
    //Set features for how the window will appear.
    var features = "location=no,menubar=no,status=no,toolbar=no";
    // Open the window.
    window.open("/main.aspx?etn=contact&pagetype=entityrecord&extraqs=" +
     encodeURIComponent(extraqs), "_blank", features, false);
}

Example: Use Xrm.Utility.openEntityForm to Open a New Window

The following sample sets default values on several different fields and shows how to use the Xrm.Utility.openEntityFormfunction. It is equivalent to the previous example that used the window.open method.

function OpenNewContact() {
 var parameters = {};
 //Set the Parent Customer field value to “Contoso”.
 parameters["parentcustomerid"] = "2878282E-94D6-E111-9B1D-00155D9D700B";
 parameters["parentcustomeridname"] = "Contoso";
 parameters["parentcustomeridtype"] = "account";
 //Set the Address Type to “Primary”.
 parameters["address1_addresstypecode"] = "3";
 //Set text in the Description field.
 parameters["description"] = "Default values for this record were set programmatically.";
 //Set Do not allow E-mails to "Do Not Allow".
 parameters["donotemail"] = "1";

 // Open the window.
 Xrm.Utility.openEntityForm("contact", null, parameters);
}

Original Url :http://msdn.microsoft.com/en-us/library/gg334375.aspx

Cheers