How to change the DashboardSettings of maximum controls limit in Dynamics CRM2011/2013

The maximum number of controls allowed on CRM2011 or CRM 2013 dashboards is 6. You cannot put the more than 6 graphs/charts/iframes/web resources etc. on the dashboard.

We can extend the number of controls as per the user needs. This setting is applied to the server not a organization setting. So you cannot change this setting for CRM Online but you can change this for an on-premise installation.

Option 1: Using Window Power Shell we can achieve it.

  1. Open the Windows Power Shell command window
  2. Add the Microsoft Dynamics CRM PowerShell snap-in using

Add-PSSnapin Microsoft.Crm.PowerShell
Sometimes You may get the message saying something like “Add-PSSnapin : Cannot add Windows PowerShell snap-in Microsoft.Crm.PowerShell because it is already added.” It is fine no problem.

3.  Run the following 3 commands

$setting = Get-CrmSetting -SettingType DashboardSettings

$setting.MaximumControlsLimit = 10

Set-CrmSetting -Setting $setting

After that open CRM, still you will be see only 6 components on the dashboard design, however you can add extra components based on how much you have set the limit.

Once you crossed the limit you will get following error message.

DashboardSettings

Option 2: If Powershell does not work, use following C# code to do the same

  public static void UpdateDashboardSettings()
        {
            //Create Instance of Deployment Service
            DeploymentServiceClient service = Microsoft.Xrm.Sdk.Deployment.Proxy.ProxyClientHelper.CreateClient(new Uri("http://CRMServer/Organization/XRMDeployment/2011/Deployment.svc"));
            //Use Default network Credentials(User should de Deployment Admin in Deployment Manager and System Admin in CRM)
            service.ClientCredentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;

            //Retrieve Current Dashboard Settings MaximumControlsLimit
            Microsoft.Xrm.Sdk.Deployment.RetrieveRequest retrieveReq = new Microsoft.Xrm.Sdk.Deployment.RetrieveRequest();
            retrieveReq.EntityType = DeploymentEntityType.DashboardSettings;

            Microsoft.Xrm.Sdk.Deployment.RetrieveResponse retrieveRes = (Microsoft.Xrm.Sdk.Deployment.RetrieveResponse)service.Execute(retrieveReq);
            if (retrieveRes != null && retrieveRes.Entity != null)
            {
                DashboardSettings dsCurrentResult = (DashboardSettings)retrieveRes.Entity;
                if (dsCurrentResult != null)
                    Console.WriteLine("Current DashboardSettings MaximumControlsLimit is " + dsCurrentResult.MaximumControlsLimit);
            }
            //Update Current Dashboard Settings MaximumControlsLimit = 10
            Microsoft.Xrm.Sdk.Deployment.UpdateRequest updateReq = new Microsoft.Xrm.Sdk.Deployment.UpdateRequest();
            DashboardSettings ds = new DashboardSettings();
            ds.MaximumControlsLimit = 10;
            updateReq.Entity = ds;
            Microsoft.Xrm.Sdk.Deployment.UpdateResponse updateRes = (Microsoft.Xrm.Sdk.Deployment.UpdateResponse)service.Execute(updateReq);

            //Retrieve again after updating Current Dashboard Settings MaximumControlsLimit
            Microsoft.Xrm.Sdk.Deployment.RetrieveRequest retrieveReq1 = new Microsoft.Xrm.Sdk.Deployment.RetrieveRequest();
            retrieveReq1.EntityType = DeploymentEntityType.DashboardSettings;
            Microsoft.Xrm.Sdk.Deployment.RetrieveResponse retrieveRes1 = (Microsoft.Xrm.Sdk.Deployment.RetrieveResponse)service.Execute(retrieveReq1);

            if (retrieveRes1 != null && retrieveRes1.Entity != null)
            {
                DashboardSettings dsUpdatedResult = (DashboardSettings)retrieveRes1.Entity;
                if (dsUpdatedResult != null)
                    Console.WriteLine("After Updating DashboardSettings MaximumControlsLimit is " + dsUpdatedResult.MaximumControlsLimit);

            }
        }

NOTE: You need add microsoft.xrm.sdk.deployment DLL from SDK to access those Deployment classes and methods. User who is running this should be Deployment Admin in Deployment Manager and Sys Admin in CRM

Incase if you are getting 404 error while accessing Deployment service, you need to check your CRM web server IIS settings and make sure XRMDeployment is not configured in Hidden Segments in IIS, Follow below steps to remove/add XRMDeployment setting in IIS

  1. Open Internet Information Services(IIS) Manager
  2. Expand Server on left navigation
  3. Expand Sites on the Left Navigation
  4. Click on Microsoft Dynamics CRM
  5. Click on “Request Filtering” icon in IIS on right side window
  6. Click on “Hidden Segments” tab on Request Filtering window on right side
  7. If “XRMDeployment” exists then select “XRMDeployment” and right click on “Remove” and say “Yes” to remove “XRMDeployment” from Hidden Segments
  8. Once you are done executing PowerShell, SDK Code you can add using “Add Hidden Segment” option, enter “XRMDeployment” in Hidden Segment window and click on “OK” to close the window.
Advertisement

Dynamics CRM 2013 SDK version 6.0.4 available

Microsoft Dynamics CRM 2013 latest SDK Version SDK Version 6.0.2 is now available on MSDN download center.

The following table lists the significant changes made to this version of the SDK.

New and updated topics Description of changes
SDK\Bin Updated the assemblies for Microsoft Dynamics CRM 2013 Update Rollup 2. These assemblies are also compatible with the latest service update for Microsoft Dynamics CRM Online.
SDK\Bin\SolutionPackager.exe Fixed the issue where Solution Packager failed to repack solutions that contain entity level business rules.
Authenticate the user with the web services
Walkthrough: Register a CRM app with Active Directory
Sample: Windows 8 desktop modern SOAP app
Sample: Windows 8 desktop modern OData app
Updated the documentation to include use of Active Directory Federation Services (AD FS) 3.0.
Configure email for incoming messages
SampleCode\CS\BusinessDataModel\
BusinessManagement\ConfigureQueueEmail.cs
SampleCode\VB\BusinessDataModel\
BusinessManagement\ConfigureQueueEmail.vb
Documented deprecated and read-only attribute changes for the email user name and password attributes in the Queue and UserSettings entities.

Changed the sample code, removing the lines of code that set the attributes.

Create a custom workflow activity Removed support for Microsoft .NET Framework 4.5. Added the requirement to digitally sign the assembly.
Install or uninstall the Developer Toolkit Added a statement that the Developer Toolkit can’t be installed into the Express edition of Microsoft Visual Studio.
Xrm.Page.ui (client-side reference) The Xrm.Page.ui.getCurrentControl method is deprecated in Microsoft Dynamics CRM 2013 Update Rollup 2.

Microsoft Dynamics CRM 2013 Update Rollup 2 is available

Update Rollup 2 for Microsoft Dynamics CRM 2013 is available.

Check out Microsoft KB article Rollup 2 for Microsoft Dynamics CRM 2013 KB Article

This rollup is available for all languages that are supported by Microsoft Dynamics CRM 2013.

Update Rollup 2 introduces support for the following:

  • Windows 8.1 and Internet Explorer 11 using CRM 2013 web application and CRM for Tablets
  • iOS7 support with Safari on iPad using the web application
  • Support for Safari using web application and CRM for Tablets using the tablet app for iPad Air
  • Windows Server 2012 R2 for CRM Server

Download link for Microsoft Dynamics CRM 2013 Update Rollup2: http://www.microsoft.com/en-us/download/details.aspx?id=42272

Best practices for reports in Dynamics CRM 2013

The following best practices can help you to produce reports that are easier to write, comply with established standards, and execute with improved efficiency.

General best practices: This section provides best practices for creating custom SQL-based and fetch-based reports.

  • Use an existing report to create custom reports: Check whether there is an existing report in Microsoft Dynamics CRM that is close to the design that you are looking for. Download the report definition of the report, and then modify the RDL file instead of creating a new one from scratch. By doing this, you will save development time and reduce report writing errors.
  • Use Microsoft Dynamics CRM formats for currency, number, date and time, calendar: The FilteredUserSettings view contains information about currency format, date and time format, number format, negative number, starting day of the week, calendars, and other formats. Microsoft Dynamics CRM provides the fn_GetFormatStrings database function to obtain the date, time, number, currency, and calendar formats from the FilteredUserSettings view.
  • Set the page size: Reporting Services does not provide explicit page orientation, such as portrait and landscape modes, or preset page sizes. Standard Microsoft Dynamics CRM reports were designed for 8.25 x 11 (portrait) or 11 x 8.25 (landscape) page sizes that work for both US letter and A4 paper.
  • Back up your reports: Make backup copies of your reports and store them on a computer other than the reporting server.
  • Define truncation if needed: Text wrapping is the default behavior for a text box report item in Reporting Services. This means that, unless indicated otherwise, all text will wrap at the defined width of any text area and then grow vertically. If truncation is specified, a text box will truncate text at the width of the text box within the specified padding (default is 2pt left and right.) Any maximum length truncation beyond this will require custom coding. The default Microsoft Dynamics CRM reports are set up with tool tips to show static text or values from data fields when the user hovers the mouse pointer over the report item. If you use truncation, consider setting the ToolTip property to the field value so that the full text will appear when the user hovers over the truncated text.

SQL-based reports: This section provided best practices for SQL-based reports only.

  • Writing stored procedures: Adding custom stored procedures to the Microsoft Dynamics CRM database is not supported. However, you can create a separate database and write stored procedures to that database.
  • Limit text length and number of items in charts: Microsoft Dynamics CRM reports use only some of the possible chart types from Reporting Services.For any chart type, limiting label length and number of items is recommended for the chart contents to be displayed correctly. When Reporting Services displays a chart with long labels, the chart itself becomes too small to be usable. There are several ways to do this:
      • Limit your chart label length explicitly, truncating it if it is necessary.
      • Consider limiting the number of items displayed in charts.
  • Use embedded images in a report: The easiest way to use images with Reporting Services is to put the images into a database. If the images are not in a database, you can use embedded images in .png, .gif, or .jpg formats in a report. The image files that are used by Microsoft Dynamics CRM image files are located in the C:/Inetpub/wwwroot/_imgs/ico folder on a default Microsoft Dynamics CRM installation.

Dynamics CRM 2013 User Interface Integration package is available

Microsoft Dynamics CRM 2013 User Interface Integration package is now available on MSDN download center.

MicrosoftDynamicsCRM2013UII.exe is available as a separate download from the SDK download page. It contains User Interface Integration (UII) solution framework, which includes a deployment guide, development guide and api reference. UII uses Microsoft Dynamics CRM for the delivery of configuration data for the Integrated Agent Desktop. It includes development and run-time components. Applications built with UII can provide unified access to customer information across different systems and can aggregate different modes of customer interactions or channels.

User Interface Integration (UII) for Microsoft Dynamics CRM uses the features of Dynamics CRM to deliver composite applications that share a common user interface. UII includes development and run-time components. Applications built with UII can provide unified access to customer information spread across different systems, and can aggregate different modes of customer interactions or channels. Unlike expensive, rip and replace approaches or risky investments on custom development, UII provides non-intrusive integration with existing systems.

Dynamics CRM 2013 SDK version 6.0.2 available

Microsoft Dynamics CRM 2013 latest SDK Version SDK Version 6.0.2 is now available on MSDN download center.

The following table lists the significant changes made to this version of the SDK.

Topic Description of changes
SDK\Bin Updated the assemblies for Microsoft Dynamics CRM 2013 Update Rollup 1. These assemblies are also compatible with the latest service update for Microsoft Dynamics CRM Online.
Handle exceptions in your code Added information about how to view the details of an exception that are hidden from the user because of insufficient permissions.
Organization entity attributes Added topic listing all the attributes that can be set for an organization.
Sample: Set and retrieve entity images New sample to show how to work with entity images.
Xrm.Page.ui control (client-side reference) Added information about a new parameter in the setNotification and clearNotification methods. The uniqueId parameter allows you to clear a specific notification set on a field, based on the uniqueId value used when the notification was set.
SDK Versions 6.0.3 and 5.0.18 coming this week Adding authentication related documentation and updated sample code to support the transition of Microsoft account subscriptions to Microsoft online services. This applies only to Microsoft Dynamics CRM Online customers.
Actions on entity records Updated metadata information.
Authenticate the user with the web services Added OAuth provider URLs.
Command bar or ribbon presentation Updated the CRM for tablets section to note that icons configured for commands won’t display and labels that are too long will be truncated.
<CrmParameter> (RibbonDiffXml) Changed description of the SelectedControlSelectedItemReferences attribute to fix an error. This option is only available when used with the <JavaScriptFunction> (RibbonDiffXml) element, not the <Url> (RibbonDiffXml) element.
Dialog limitations Added information about nested steps.
Form events (client-side reference) Added a note to the OnLoad Event section saying: Forms for Updated entities don’t reload the page after the initial save creating a record or any subsequent saves. Therefore, the OnLoad event occurs only during the initial load of the form.
Form scripting quick reference Updated this topic to include examples of new form methods.
Lookup information for the post entity and post follow entity Explained how to retrieve lookup information for the RegardingObjectId.Target property for the post entity and post follow entity.
Open forms, views, dialogs and reports with a URL Updated this topic as well as <JavaScriptFunction> (RibbonDiffXml) and <Url> (RibbonDiffXml) to add a note to say that opening entity forms in a dialog window using showModalDialog or showModelessDialog isn’t supported.
In the application, always use Xrm.Utility.openEntityForm instead of window.open to open entity forms.
Model business process flows Updated information about maximum number of activated business process flows per entity. See section: Maximum number of processes, stages, and steps.
<PageRule> (RibbonDiffXml) Added remarks to note that this rule can’t be used in Microsoft Dynamics CRM for tablets because it will always refer to one page.
Sample: Windows 8 desktop modern SOAP app
Sample: Windows 8 desktop modern OData appSampleCode\CS\ModernAndMobileApps
Added new sample applications that show how to write a Windows 8 desktop modern application that can send requests to the organization web service without linking to the SDK assemblies.
Sample: Windows 8 desktop modern SOAP app uses the Windows Azure Active Directory Authentication Library (ADAL) and the SOAP protocol.
Sample: Windows 8 desktop modern OData app uses the ADAL and the OData protocol.
<Url> (RibbonDiffXml) Added a note to this topic saying that it shouldn’t be used to open entity forms. Use <JavaScriptFunction> (RibbonDiffXml) with a function using Xrm.Utility.openEntityForm instead.
Walkthrough: Connect with CRM using Java Walkthroughs\Java2CRM Removed sample code and walkthrough. Now that Microsoft Dynamics CRM Online is transitioning from the legacy billing and administration platform to the Microsoft online services environment, this sample is no longer relevant. For more information about using CRM Online or CRM 2013 IFD with Java or other non-.NET languages, see the blog post: Use OAuth to authenticate with the CRM service.
Walkthrough: Register a CRM app with Active Directory Changed the instructions from using the Windows Azure portal to using Graph Explorer.
Write and debug scripts for CRM for tablets Added new topic to consolidate information related to writing scripts for Microsoft Dynamics CRM for tablets.
Write code for Microsoft Dynamics CRM forms Added a note to the Different Form Presentations section to say that the collaboration control found in updated entity forms isn’t accessible using form scripts. The section containing the control is available if you want to show or hide the section and the control in it.
Write scripts for composite attributes Added information to the Composite attributes in the web application section about the naming convention used to access the individual constituent controls displayed in the flyout for composite controls in the web application.
Xrm.Page.ui control (client-side reference) Updated information in the getAttribute section to note that constituent controls for quick view forms can access the value of an attribute, but any changes to the value of this attribute won’t be saved.

Microsoft Dynamics CRM 2013 Update Rollup 1 is available

Update Rollup 1 for Microsoft Dynamics CRM 2013 is available.

Check out Microsoft KB article Rollup 1 for Microsoft Dynamics CRM 2013 KB Article

Update Rollup 1 for Microsoft Dynamics CRM 2013 is available for on-premises customers. This rollup is available for all languages that are supported by Microsoft Dynamics CRM 2013. Update Rollup 1 contains stability and memory-consumption improvements.

Update Rollup 1 resolves the following issues:

  • Publishing a CRM report fails as the parent report already links to another report with same name.
  • Invalid Argument when navigating to view with related entity lookup.
  • The chart (for any other entity) does not display in Korean due to System.ArgumentException: “Value of ‘Malgun Gothic, Segoe UI, 9.5px’ is not valid for ‘units’.”
  • Script error occurs when moving from a form. “Unable to get property ‘get_filterType’ of undefined or null reference”
  • Disabling checkbox fields using the JavaScript API does not work.
  • Creating a workflow to update an appointment with fields from the regarding Lead field fails. “An unexpected error occurred.”
  • Hiding the last field of a section does not hide the section. Hiding the last field of a tab does not collapse the tab.
  • Unable to create automatic full address field workflows, as the spaces and tabs are removed if there are no other symbols like comma.
  • Using the Quick Search in Outlook and clicking Advanced Find right afterwards, the Advanced Find filter is populated with irrelevant criteria.
  • Re-import of existing solution fails with The label for base language code 1033 is not set.
  • Users cannot associate multiple records at once for N:N relationships.
  • CRM 2013 no longer warns you when you are about to delete a parent record that child records with cascade delete set on their relationships to the parent will also be deleted.
  • Unable to set a web resource to visible in script if ‘Visible by default’ not set in designer.
  • You´ve created a new business process flow and assigned that process flow to the security role of “sales manager”, “system administrator” and “system customizer”. You publish this modification and expect the process the be visible only for these security roles.Instead the BPF is hidden for all users.Instead the BPF is hidden for all users.
  • When data is entered into a form, the Save button can be clicked multiple times which results in multiple of the same record being created.
  • For a custom duration field Xrm.Page.getAttribute(“durationfield”).getValue() method returns a formatted value like30 minutes instead of 30 as expected.
  • When organization is deleted and then immediately imported back, import organization wizard unexpectedly displays a warning about version mismatch.
  • Autosave off: Entity form looses command bar after navigating away and re-opening.
  • Consider you’ve created a Business Process for cases having a related task stage with several steps and you’d like to translate all stages to different language. Your solution contains task and case entity as well as Business Process. You’re exporting translation files and try to edit those. You’ll find all stage names from case entity, but you do not find those of the related task step. Therefore you cannot translate those.
  • “Email a link” URL does not navigate to the specified entity if opened in existing browser tab.
  • Errors occur when using different country formats with currency attributes.
  • When browsing to various locations in CRM, a JavaScript exception is thrown that reports “Object expected”.
  • The .addCustomFilter javascript function does not work properly.
  • Workflow triggered on Before Delete event cannot be imported in a new organization.
  • When email activity with unresolved email recipient is created and saved, on load on email, value in TO field is hidden, field is empty.
  • Not able to see “Page Index” on subgrids from dashboards.
  • Published customization changes do not roll down to mobile client consistently.
  • Opportunity closed as won does not take custom status reason while closing.
  • Notes control shows time but not date for notes created before yesterday.
  • Mobile clients crash with UI Error: “We’re sorry. Sorry, something went wrong while initializing the app. Please try again, or restart the app”
  • Access team does not use correct metadata driven by Advanced Find view and hence fails in Mobile Clients.
  • If you create a new email message in the Microsoft Dynamics CRM 2013 web application, you discover that you cannot modify the Description field when using the latest version of Google Chrome.

JavaScript references in Microsoft Dynamics CRM 2013

The JavaScript object model is the JavaScript API that CRM provides to enable you to customize various behaviors based on events and to access CRM data that is present on a form.

CRM 2013 fully supports the JavaScript object model from the previous version; however, it does not support the JavaScript object model from Microsoft Dynamics CRM 4.0.

Check out following reference documentation for client-side events and object models that can be used with JavaScript libraries. * marked is new in CRM 2013.

Xrm.Utility: Xrm.Utility object provides a container for useful functions not directly related to the current page. The following table lists the functions of Xrm.Utility.

Xrm.Utility
alertDialog Displays   a dialog box with a message.
confirmDialog Displays   a confirmation dialog box that contains a message as well as OK and Cancel   buttons.
isActivityType Determine   if an entity is an activity entity.
openEntityForm Opens   an entity form.
openWebResource Opens   an HTML web resource.

Xrm.Page.data: Xrm.Page.data provides an entity object that provides collections and methods to manage data within the entity form. The following tables lists the functions of Xrm.Page.data and Xrm.Page.data.entity

Xrm.Page.data
getIsValid* Do a validation check for the data in   the form.
refresh* Asynchronously refresh all the data of the form without reloading the page.
save* Saves the record asynchronously with the option to set callback functions.
Xrm.Page.data.entity
addOnSave Adds a function to be called when the record is saved.
getDataXml Returns a string representing the xml that will be sent to the server when the record is saved.
getEntityName Returns a string representing the  logical name of the entity for the record.
getId Returns a string representing the GUID   id value for the record.
getIsDirty Returns a Boolean value that indicates if any fields in the form have been modified.
getPrimaryAttributeValue* Gets a string for the value of the primary attribute of the entity.
removeOnSave Removes a function to be called when the record is saved.
save Saves the record with the options to close or new.

Xrm.Page.context: Xrm.Page.context provides methods to retrieve information specific to an organization, a user, or parameters that were passed to the form in a query string. The following table lists the functions of Xrm.Page.context.

 Xrm.Page.context
client.getClient* Returns a value to indicate which client the script is executing in.
client.getClientState* Returns a value to indicate the state of the client.
getClientUrl Returns the base URL that was used to access the application.
getCurrentTheme Returns a string representing the current Microsoft Office Outlook theme chosen by the user.
getOrgLcid Returns the LCID value that represents   the base language for the organization.
getOrgUniqueName Returns the unique text value of the   organization’s name.
getQueryStringParameters Returns a dictionary object of key   value pairs that represent the query string arguments that were passed to the   page.
getUserId Returns the GUID of the SystemUser.Id value for the current user.
getUserLcid Returns the LCID value that represents the provisioned language that the user selected as their preferred language.
getUserName* Returns the name of the current user.
getUserRoles Returns an array of strings that represent the GUID values of each of the security roles that the user is  associated with.
isOutlookClient (Deprecated) Returns a Boolean value indicating if the user is using Microsoft Dynamics CRM for Outlook.
isOutlookOnline (Deprecated) Returns a Boolean value that indicates whether   the user is connected to the CRM server.
prependOrgName Prepends the organization name to the   specified path.

Xrm.Page.ui:  Xrm.Page.ui provides collections and methods to manage the user interface of the form. The following table lists the functions of Xrm.Page.ui

Xrm.Page.ui
clearFormNotification* Remove form level notifications.
close Method to close the form.
formSelector.getCurrentItem Method to return a reference to the   form currently being shown.
formSelector.items A collection of all the form items accessible to the current user.
getViewPortHeight Method to get the height of the viewport in pixels.
getViewPortWidth Method to get the width of the viewport   in pixels.
getCurrentControl Get the control object that currently has focus.
getFormType Get the form context for the record.
navigation.items A collection of all the navigation items on the page.
setFormNotification* Display form level notifications.
refreshRibbon Re-evaluate the ribbon data that controls what is displayed in it.
 Collections
Xrm.Page.data.entity.attributes All attributes on the page.
Xrm.Page.ui.controls All controls on the page.
Xrm.Page.ui.formSelector.items All the forms available to the user.
Xrm.Page.ui.navigation.items All the items in the form navigation   area.
Xrm.Page.ui.tabs All the tabs on the page.
Xrm.Page Attribute.controls All the controls for the attribute.
Xrm.Page.ui Section.controls All the controls in the section.
Xrm.Page.ui Tab.sections All the sections in the tab.
 Collections Methods
forEach Apply an action in a delegate function to each object in the collection.
get Get one or more object from the collection depending on the arguments passed.
getLength Get the number of items in the collection.

Attributes: Attributes store the data available in the record. Attributes are available from the Xrm.Page.data.entity.attributes collection. To access an attribute you can use the Xrm.Page.data.entity.attributes.get method or the shortcut version Xrm.Page.getAttribute. Following table shows how you can query attribute properties to understand what kind of attribute it is or change the behavior of the attribute.

 Xrm.Page.getAttribute(“…”)
getAttributeType Get the type of attribute.
getFormat Get the attribute format.
getIsDirty Determine whether the value of an   attribute has changed since it was last saved.
getIsPartyList Determine whether a lookup attribute   represents a partylist lookup.
getMaxLength Get the maximum length of string which   an attribute that stores string data can have.
getName Get the name of the attribute.
getParent Get a reference to the Xrm.Page.data.entity object that is the parent to all attributes.
getRequiredLevel Returns a string value indicating   whether a value for the attribute is required or recommended.
getSubmitMode Sets whether data from the attribute   will be submitted when the record is saved. always / never / dirty
getUserPrivilege Determine what privileges a user has   for fields using Field Level Security.
getValue / setValue Gets or Sets the data value for an   attribute.
setRequiredLevel Sets whether data is required or   recommended for the attribute before the record can be saved. none / required  / recommended
setSubmitMode Returns a string indicating when data   from the attribute will be submitted when the record is saved.
Number Attribute Methods
getMax / getMin Returns a number indicating the maximum   or minimum allowed value for an attribute.
getPrecision Returns the number of digits allowed to   the right of the decimal point.
setPrecision* Override the precision set for a number attribute.
DateTime Attribute Methods
setIsAllDay* Specify whether a date control should  set a value including the entire day.
setShowTime* Specify whether a date control should  show the time portion of the date.

Controls: Controls represent the user interface elements in the form. Each attribute in the form will have at least one control associated with it. Not every control is associated with an attribute. IFRAME, web resource, and subgrids are controls that do not have attributes. Controls are available from the Xrm.Page.ui.controls collection. To access a control you can use the Xrm.Page.ui.controls.get method or the shortcut version Xrm.Page.getControl. The following table lists the functions of Controls.

Xrm.Page.getControl(“…”)  
clearNotification* Remove a message already displayed for   a control.
getAttribute Get the attribute that the control is   bound to.
getControlType Get information about the type of   control.
getDisabled / setDisabled Get or Set whether the control is   disabled.
getLabel / setLabel Get or Set the label for the control.
getName Get the name of the control.
getParent Get the section object that the control   is in.
getVisible / setVisible Get or Set a value that indicates   whether the control is currently visible.
setFocus Sets the focus on the control.
setNotification* Display a message near the control to   indicate that data is not valid.

 Lookup Controls: The following table lists the functions of Lookup Control.

addCustomFilter* Use fetchXml to add additional filters   to the results displayed in the lookup. Each filter will be combined with an   ‘AND’ condition.
addCustomView Adds a new view for the lookup dialog   box.
addPreSearch* Use this method to apply changes to   lookups based on values current just as the user is about to view results for   the lookup.
getDefaultView / setDefaultView Get or Set Id value of the default   lookup dialog view.
removePreSearch* Use this method to remove event handler

OptionSet: The following table lists the functions of OptionSet Control.

getInitialValue Returns a value that represents the   value set for an optionset or boolean when the form opened.
getOption[s] Returns an option object with the value   matching the argument passed to the method.
getSelectedOption Returns the option object that is selected.
getText Returns a string value of the text for   the currently selected option for an optionset attribute.
adoption / removeOption Adds or remove an option to an option   set control.
clearOptions Clears all options from an Option Set   control.

IFRAME and Web Resource Controls:  An IFRAME control allows you to include a page within a form by providing a URL. An HTML web resource added to a form is presented using an IFRAME element. Silverlight and image web resources are embedded directly within the page. The following table lists the functions of IFrame or Web Resource controls.

getData / setData Get or Set the value of the data query   string parameter passed to a Silverlight web resource.
getInitialUrl Returns the default URL that an I-frame   control is configured to display. This method is not available for web   resources.
getObject Returns the object in the form that   represents an I-frame or web resource.
getSrc / setSrc Get or Set the current URL being   displayed in an IFrame or web resource.

Sub-Grid Control: Sub-Grid control has refresh method. We can use this method to refresh data displayed in a Sub-Grid.

refresh Refreshes the data displayed in a Sub-Grid.

OnChange Event: There are three methods you can use to work with the OnChange event for an attribute.

addOnChange / removeOnChange Sets or remove a function to be called   when the attribute value is changed.
fireOnChange Causes the OnChange event

Get Form types and modes in Dynamics CRM 2013

getSaveMode(), returns a value indicating how the save event was initiated by the user. The following table describes the supported values returned to detect different ways entity records may be saved by the user in CRM 2013.

execObj.getEventArgs().getSaveMode();
Event Mode Value
Save 1
Save and Close 2
Deactivate 5
Reactivate 6
Send (Email) 7
Disqualify (Lead) 15
Qualify (Lead) 16
Assign (user or team owned entities) 47
Save as Completed (Activities) 58
Save and New 59
AutoSave 70

getFormType(): Method to get the form context for the record. The following table lists the form types that correspond to the return value.

Xrm.Page.ui.getFormType();
Form Type Value
Undefined 0
Create 1
Update 2
Read Only 3
Disabled 4
Quick Create 5
Bulk Edit 6
Read Optimized 11

Dialogs in Dynamics CRM 2013

Dialogs are a type of process in Microsoft Dynamics CRM that displays the input forms and the data that a user needs at each step while interacting with a customer or following a complex procedure. A dialog can have branching logic that is based on input from the person stepping through a case, phone call, or other customer interaction.

Dialogs are frequently used in call centers to provide scripts that allow customer facing staff to apply consistent interactions with customers. You can also use dialogs to provide a kind of ‘wizard’ user interface to allow people to perform complex procedures consistently.

Dialogs provide:
– Consistent customer interactions and interactive user tasks.
– Consistent information entry into your organization’s database.
– A way for people in your organization to focus on growing your business, instead of performing repetitive tasks.

Dialogs display a series of screens based on the responses you enter to the prompts on each screen. The dialog can provide a different set of screens based on the responses you enter. After the dialog is complete, the data is saved and can be reviewed later.

Unlike workflow processes, a dialog can only be applied to one record at a time.

1. Where do I customize dialog processes?
You can see the dialogs in your organization by navigating to Settings -> Processes and filtering on processes in the Dialog category. You can also see the dialogs in your organization by viewing the Processes node in the default solution and filtering on processes in the Dialog category.

2. Dialog properties
Every dialog must have the following properties set:
Dialogs1
– Name: The name of the dialog process doesn’t need to be unique, but if you expect you’ll have a lot of dialogs, you may want to use a naming convention to clearly differentiate your processes. You may want to apply standard prefixes to the name of the dialog. The prefix may describe the function of the workflow or the department within the company. This will help you group similar items in the list of dialogs
– Entity: Each dialog process must be set to a single entity. You can’t change the entity after the dialog is created.
– Category: This property establishes that this is a Dialog process.
Unlike workflow processes, dialogs do not have scope. They are available to the entire organization. If a user runs a dialog that creates or updates record, the user must have privileges to perform those actions outside the dialog. Each dialog will create a Dialog session record and the user must have privileges to create and update those records.

3. Activating dialogs
Before you can use a dialog, you have to activate it. A dialog can only be activated or deactivated by the dialog owner. You can reassign a dialog by changing the owner. You can do this on the Administration tab. Dialogs can only be edited while they are deactivated. If you need to edit a dialog that is owned by another user, have them deactivate it and assign it to you.

4. Configure dialog processes
Dialogs provide a user interface to people who use them. You need to be familiar with what is possible within this user interface as you configure dialogs to meet your business requirements.

 4.1 Dialog components: It is helpful to see what a dialog looks like to people using them before you start configuring your first one. When you open a dialog process to use it you will see a window like the one shown in the following screenshot:
Dialogs2

A dialog will have the following components:

Header: Includes the name of the Dialog and the name of the current page.
Prompt and Response: Shows each of the prompts and responses added to the page. The prompts tell the user what to do or say, and the responses provide a place to enter data that could be used to set a value in a CRM record or just to control the flow of the dialog. Responses are optional.
Tip: Provides additional detail not included in the prompt. The tip shown changes depending on which prompt has focus.
Comments: Use comments to capture information that will remain available as you progress through the dialog. You might want to type notes in this comments section to provide additional detail not captured in the responses.
Help: Opens the Microsoft Dynamics CRM application help topic for dialogs.
Summary: Opens the dialog session. The Dialog session displays the data captured by the dialog. While you are using a dialog, the session will show the data set for previous pages.
Previous: After the first page of the dialog you can use this button to go to previous pages.
Next: Advances to the next dialog page.
Finish: After the last dialog page, this button will close the dialog with a status of completed.
Cancel: Closes the dialog with a status of cancelled. It is not possible to resume a cancelled dialog.

To configure a dialog after it is created you will view a page like the following screen that contains data from a Page containing a ‘Prompt and Response’.
Dialogs3
Like other processes, you can change the name, activate as a process template and configure the process to run as either an on-demand process or a child process. If you leave both of the ‘Available To Run’ options unchecked when you activate the dialog, it will be set as an on-demand process.
‘Input Arguments’ are only used for processes that are configured to be used as a child process.
Use ‘Variables’ to set values that are stored within the dialog process. Variables are useful when a process gathers data through the course of several pages and this data may be used to perform calculations. For example, a dialog might be used to calculate a standard rating value based on the answers to several questions.

4.2 Steps available for dialogs: Most of the steps available for dialogs are the same as those common for processes with the exception of Page, Prompt and Response, Link Child Dialog, and Query CRM Data.
4.2.1 Page: Page is a container for Prompt and Response steps. You must include a Page before you can add a Prompt and Response.
 4.2.2 Prompt and response: The ‘Prompt and Response’ step properties are the most important parts of the dialog. You must add at least one prompt and response step before the dialog can be activated.
Tip: Don’t add too many Prompt and Response steps to a single page because it will require the user to scroll down the page. It is better to add additional pages so that people can click through the pages without scrolling.
After you add a prompt and response, click ‘Set Properties’ to open the ‘Define Prompt and Response’ dialog.
Dialogs4
A ‘Prompt and Response’ step has the following properties:
Dialogs5
4.2.2.1 Statement Label: The statement label should provide an appropriate heading for the Prompt Text. The Statement Label is visible in the dialog session when viewing the summary during or after the dialog is completed.
4.2.2.2 Prompt Text: Prompt Text may represent something the person using the dialog should say to the customer or it could include instructions about how to complete a step of a complex procedure
4.2.2.3 Tip text: Tip text provides additional information to support the Prompt Text.
4.2.2.4 Response Type: Choose one of the following Response Types:
None: You can add a prompt without a response.
Single Line: A single line can represent a text, integer or float data by setting the Data Type.
Option Set (Radio Buttons): The results are presented as a set of Radio buttons. Use this option when there are just a small number of options to choose from. The data selected can be set to either text, integer or float data by setting the Data Type. You can choose to define static values or query CRM Data to provide a list of options.
Options Set (Picklist): This is exactly like Option Set (Radio Buttons), except that the options are displayed as a list. Use this option when there are very many options to choose from.
Multiple Lines (Text Only):Provides an area to type text with multiple lines.
Date and Time: Provides a control to set a date and a time.
Date only: Provides a control to set a date.
Lookup: This option will present one of the lookup fields used in the application. When you select this option the following fields appear and you must provide values for them:
Reference Entity: An entity that contains the lookup you want to use
Reference Field: The specific lookup in the reference entity that you want to use.
Tip: If you want to have a list for an entity that has no many-to-one entity relationships, you can create a custom entity and then create a one-to-many relationship between it and the entity that you want to appear in the list. Since this custom entity has no other purpose than to allow this lookup, make sure to configure it so that it is not visible in the application and set the entity description to indicate the purpose of the entity.

4.2.2.5 Data Type: When you select a ‘Response Type’ of Single Line, Option Set (radio buttons), or Option Set (picklist), you can choose to have the data set in the control be expressed using one of the following data types: Text, Integer, Float
When you select a ‘Response Type’ of Lookup, the Data Type field is replaced by the Reference Entity field.
 4.2.2.6 Log Response: When you choose to not log responses you will still be able to access the responses as variables within your dialog, but the data in the response will not be saved with the dialog session. This is a security feature. Consider if you have a dialog that requires some personal information to be entered and processed. If the response is not logged it will not be saved with the dialog session record that contains the data in the dialog summary.
4.2.2.7 Default value: Use default value to set a value to indicate that the data in the response was not provided or represents a very common response which would only need to be edited if it was different.
4.2.3 Link child dialog: In the same way you might use child Workflows, you can also define child dialogs to create re-usable dialogs that you can re-use from other dialogs. If the child dialog has any input parameters, when you call the child dialog you need to map any available variables or responses to the input variables defined for the child dialog.

– Setting input arguments for a child process: If you attempt to enter Input arguments for a process configured as an on-demand process, you will be prompted to change the ‘Available to Run’ value to ‘As a Child Process’. After you enter Input arguments, you will not be able to set the process to be an on-demand process until all the input arguments have been removed.

Input arguments can be of the following types:
– Single Line of Text
– Whole Number
– Floating Point Number
– Date and Time
– Date Only
– Lookup
With each type, you can set a default value to be used if the calling dialog doesn’t provide data to the input argument.

4.2.4 Query CRM Data: If your dialog depends on the ability to display some data that is retrieved from CRM you should add a ‘Query CRM Data’ step before you need to view this data as either of the Option Set response types.

When you define a query you are shown a screen based on the ‘Advanced Find’ page. You can define a new query or use one of the existing views. When any of the queries requires setting a specific value, that value is considered a variable. For example, you can create a query that shows all the Case records where a specific Account is the Customer. For the query to work, you must specify an Account Record to be the placeholder. Then, when you select the Modify Query Variables tab you will see the FetchXML representation of the query with a variable generated where you had specified a specific Account in your query.

You need to use the Form Assistant to set a slug to represent the Account record that is the context of a Dialog defined for the account entity.

Dialogs6

After you have done this you can Save and Close the Query. If you click the ‘Design New’ tab at this point, your dynamic value set for this query will be removed and you will need to add it back again.
You can have a query with variables and not use a dynamic value, but then the results shown will be the same with every dialog.
– Using query variables: Once you have defined a query variable you will typically use in a response using the Options Set (picklist) Response Type. You can specify which of the columns in the query you want to display and some text to separate the values that are displayed on the list.
Dialogs7
The result is that in the dialog people can select from the results.
Dialogs8