126 Tuesday, December 27, 2016 |
Suresh Maurya
Dynamics CRM Consultant at IBM

Form events in MS CRM?

  • OnLoad Event
    • The OnLoad event occurs after the form has loaded.
    • It cannot prevent the window from loading.
    • Use the OnLoad event to apply logic about how the form should be displayed, to set properties on fields, and interact with other page elements.
  • OnSave Event
    • The OnSave event occurs when:
    • The user clicks the Auto save button button in the lower right corner of the form, even when there is no changed data to be saved.
    • Code executes the Xrm.Page.data.entity.save method, even when there is no changed data to be saved.
    • The user navigates away from the form and there is unsaved data in the form.
    • With auto-save is enabled, 30 seconds after data has changed and there is unsaved data in the form.
    • Code executes the Xrm.Page.data.save method and there is unsaved data in the form.
    • Code executes the Xrm.Page.data.refresh method passing a true value as the first parameter and there is unsaved data in the form.
  • Field OnChange Event
    • The OnChange event occurs when:
    • The data in a form field has changed and focus is lost.
    • Radio buttons or check boxes clicked.
    • Calling Xrm.Page.data.entity attribute.fireOnChange method.
    • The OnChange event does not occur if the field is changed programmatically using the setValue method. If you want call attribute.fireOnChange method.
  • Tab TabStateChange Event
    • The TabStateChange event occurs when the DisplayState of the tab changes due to user interaction or when the setDisplayState method is applied in code.
    • Use this event when you wish to change the src property of an IFRAME within the tab.
    • If you set the IFrame src property in the OnLoad event for an IFRAME within a collapsed tab, the value will be overwritten when the tab is expanded.
  • IFRAME OnReadyStateComplete Event
    • The OnReadyStateComplete event indicates that the content of the IFRAME has loaded and can be accessed in code.
    • Use this event when referencing IFRAME controls within your scripts.
  • Lookup Control PreSearch Event
    • The lookup control has a PreSearch event that occurs just before the control launches a dialog to search for records.
    • There is no UI to set event handlers for this event.
    • You must use the addPreSearch and removePreSearch methods on the lookup control to add or remove event handlers for this event.
  • OnProcessStatusChange Event
    • This event occurs when the status of a process instance changes.
    • Use the Xrm.Page.data.process.addOnProcessStatusChange method to add event handlers for this event
    • and the Xrm.Page.data.process.removeOnProcessStatusChange method to remove them.
  • OnStageChange Event
    • This event occurs when the user clicks the Next Stage or Move to previous stage buttons in the user interface
    • or when a developer uses the Xrm.Page.data.process.moveNext or Xrm.Page.data.process.movePrevious methods.
    • You can’t cancel the stage change using code in a handler for this event.
  • OnStageSelected Event
    • This event occurs when a stage of a business process flow control is selected.
    • You can’t cancel the stage selection using code in a handler for this event.
  • Knowledge Base Search Control Events
    • The knowledge base search control can only be added to forms for organizations that has the knowledge management feature enabled. This control has two events (OnResultOpened and OnSelection) that developers can programmatically assign event handlers to.
  • Subgrid OnLoad event
    • Subgrids load asynchronously from the form so you can’t reliably get access to the data in the subgrid in the form OnLoad event. But you can set an event handler for the OnLoad event of the subgrid.
    • This event will occur each time the data in the grid is refreshed, this includes when users sort the columns of the grid.
  • Editable Grid Events
    • OnRecordSelect
      • The OnRecordSelect event occurs when a single row (record) is selected in the editable grid. This event won't occur if a user selects different cells in the same row, or selects multiple rows.
    • OnChange
      The OnChange event occurs when a value is changed in a cell in the editable grid and the cell loses focus. This event can also occur when an attribute value is updated using the setValue method.
    • OnSave
      • The OnSave event occurs before sending the updated information to the server, and when any of the following occurs:
        There is a change in the record selection.
        The user explicitly triggers a save operation using the editable grid’s save button.
        The user applies a sort, filter, group, pagination, or navigation operation from the editable grid while there are pending changes.

Activity Feeds Disable Rules (4 of 5): Dynamics CRM 2011

This snack explains how activity feeds allows users to stay up to date on the CRM records that are most important to them. After you complete this snack you will be able to:

• Install activity feeds

• Configure entities for activity feeds

• Disable activity feeds rules

• Auto post activity feeds

Microsoft Dynamics CRM 2016 Certifications

Microsoft Dynamics CRM 2016 Certification Exams

What are methods in IOrganizationService

  • Use the IOrganizationService.Create method to create an instance (record) of any entity that supports the Create message, including custom entities.
  • Use the IOrganizationService.Retrieve method to retrieve an instance (record) of an entity.
  • Use the IOrganizationService.RetrieveMultiple method to retrieve a collection records. The query can be specified using a query expression or Fetch XML query. If the query includes an aggregate function.
  • Use the IOrganizationService.Update method to update an existing record.
  • Use the IOrganizationService.Delete method to delete an existing record.
  • Use the IOrganizationService.Associate method to create a link between two records that participate in a relationship.
  • Use the IOrganizationService.Disassociate method to delete the link between two records.
  • Use the IOrganizationService.Execute method to execute a message. This includes common processing like create and delete of data records and metadata, or it can be specialized processing such as import or detect duplicates.

Microsoft Dynamics Social CRM

Opportunity : Losing an Opportunity

To close an opportunity with a status of Lost, follow these steps:

  • In the Navigation Bar, click Sales, and in the Sales area, click Opportunities.
  • Select an open opportunity in the data grid.
  • On the Opportunities tab, in the Actions group, click Close as Lost.
  • Accept the default values for the Status Reason, Actual Revenue
    and Close Date fields.
  • Optionally, you can associate a lost opportunity with a competitor by specifying a value in the Competitor field.
  • Click OK

Customization Toolkit Overview - Microsoft Dynamics CRM 2011

This video is an overview of how to customize Dynamics CRM 2011. The video goes through a design scenario that demonstrates how to configure the forms, fields, views, charts and dashboards.

Solutions Management in Microsoft Dynamics CRM 2011

This demo shows how developers and ISVs can manage thier solutions in Microsoft Dynamics CRM 2011.

Generate early bound entity classes with the code generation tool (CrmSvcUtil.exe)

CrmSvcUtil.exe is a command line tool which can generate early bound classes for Microsoft Dynamics CRM. Output file can be C# or VB.Net file.

Generated file contains 

  • All entities, one partial class for each entity
  • All attributes
  • All relationships

These strongly typed classes provide early binding and Intellisense support in Microsoft Visual Studio.

Generated file can be referenced by projects that use Microsoft Dynamics CRM. Following assemblies must also be referenced in that project

  • Microsoft.Crm.Sdk.Proxy.dll
  • Microsoft.Xrm.Sdk.dll

These assemblies can be found in SDK\bin folder of the SDK.

Running code generation tool

Make sure Microsoft.Xrm.Sdk.dll  assembly is in same folder.

For On-premises

CrmSvcUtil.exe /url:http://<serverName>/<organizationName>/XRMServices/2011/Organization.svc    /out:<outputFilename>.cs /username:<username> /password:<password> /domain:<domainName>    /namespace:<outputNamespace> /serviceContextName:<serviceContextName>

 

For Microsoft Dynamics CRM Online

CrmSvcUtil.exe /url:https://<organizationUrlName>.api.crm.dynamics.com/XRMServices/2011/Organization.svc    /out:<outputFilename>.cs /username:<username> /password:<password>     /namespace:<outputNamespace> /serviceContextName:<serviceContextName>

 

Correct URL can be found at

Settings > Customization > Developer Resources

To list the supported command-line parameters, use the following command.

CrmSvcUtil.exe /?

 

Parameters

The following table lists the code generation tool parameters and a gives a brief description of their use.

Parameter

Shortcut

Description

Required

deviceid

di

Device ID used when you connect to the Online server for authentication. Only required if the device ID has not been stored on disk in the %USERPROFILE%\LiveDeviceID folder. Only used with the Microsoft account identity provider.

False

devicepassword

dp

Device password that is used when you connect to the Online server for authentication. Only required if the device password has not been stored on disk in the %USERPROFILE%\LiveDeviceID folder. Only used with the Microsoft account identity provider.

False

domain

d

The domain to authenticate against when you connect to the server.

False

url

 

The URL for the Organization service.

True

out

o

The file name for the generated code.

True

language

l

The language to generate the code in. This can be either “CS” or “VB”. The default value is “CS”.

False

namespace

n

The namespace for the generated code. The default is the global namespace.

False

username

u

The user name to use when you connect to the server for authentication.

False

password

p

The password to use when you connect to the server for authentication.

False

servicecontextname

 

The name of the generated organization service context class. If no value is supplied, no service context is created.

False

help

?

Show usage information.

False

nologo

 

Suppress the banner at runtime.

False

generateActions

 

Generate request and response classes for actions.

 

interactivelogin

il

When set to true, a dialog to log into the CRM service is displayed. All other connection related parameters specified on the command line are ignored.

False

connectionstring

connstr

Contains information, provided as a single string, for connecting to a CRM organization. All other connection related parameters specified on the command line are ignored. For more information see Use connection strings in XRM tooling to connect to CRM.

False

 

Usage Examples

On-Premises

CrmSvcUtil.exe /url:https://myport:555/MyOrg/XRMServices/2011/Organization.svc /out:GeneratedCode.cs /username:administrator /password:password

Microsoft Dynamics CRM Online -  Microsoft Identity Provider

CrmSvcUtil.exe /url:https://myorg.api.crm.dynamics.com/XRMServices/2011/Organization.svc /out:GeneratedCode.cs /username:"myname@live.com" /password:"myp@ssword!"


Microsoft Dynamics CRM Online -  Microsoft Office 365 

CrmSvcUtil.exe /url:https://myorg.api.crm.dynamics.com/XRMServices/2011/Organization.svc /out:GeneratedCode.cs /username:"myname@myorg.onmicrosoft.com" /password:"myp@ssword!"

Claims Authentication - IFD

CrmSvcUtil.exe /url:https://myorg.crm.com:555/XRMServices/2011/Organization.svc /out:GeneratedCode.cs /username:administrator /password:p@ssword! 

 

Use the Configuration File

The CrmSvcUtil.exe.config configuration file must be in the same folder as the CrmSvcUtil.exe tool.

If you enter a value at the command line, that value will be used instead of the one in the configuration file. 

Do not include the url and namespace parameters in the configuration file. These must be entered from the command line when the CrmSvcUtil.exe tool is being run.

The following sample shows how to configure the output file and the domain name parameters in the application configuration file using shortcut keys.

<appSettings> <add key="o" value="CrmProxy.cs"/> <add key="d" value="mydomain"/></appSettings>
 

Enable Tracing

To enable tracing when you run the tool, add the following lines to the configuration file:
<system.diagnostics> 
   <trace autoflush="false" indentsize="4"> 
      <listeners> 
         <add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener"> 
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Error" /> 
         </add> 
      </listeners> 
   </trace> 
</system.diagnostics>
 

How to hide ribbon button?

  1. Create a solution add the entity what you want and export it and extract it xml designer.
  2. Then navigate into the location RibbonDiffXml next add the customaction tag
  3. Then add the <hidecustomaction by specifying the hideactionid and location.

Getting started with Microsoft Dynamics CRM 2013

Color Grid for Dynamics 365

Color Form for Dynamics 365