58 Wednesday, January 4, 2017 |
Suresh Maurya
Dynamics CRM Consultant at IBM

Lead to Opportunity Process Flow

Microsoft Dynamics CRM 2013 Customization New Features - Image Data Type

Managing Goals - Microsoft Dynamics CRM 2011

This video goes through the process of managing Goals in Dynamics CRM 2011. The video explains the key terms and goes through how to manage goals and where they are on the CRM 2011 dashboards.

Manage service cases in Dynamics CRM

Take a tour of the Service area in Dynamics CRM. We'll step through a few of the most common activities like creating a case, finding similar cases to draw solutions from, and adding notes so everything said and done is tracked. All the details are stored in CRM where everyone can find them.

Microsoft Dynamics CRM 2013 Customization New Features - Phone Number Format

Add Marketing Capabilities - Microsoft Dynamics CRM 2011

In this video we review:

  • Marketing Lists
  • Campaigns
  • Quick Campaigns

We also give some recommendations on how you can easily phase marketing capabilities into your current CRM implementation.

CRM Rules! for Microsoft Dynamics CRM 2011: Intro Demo #1

Connect To Microsoft Dynamics CRM Using Organization Service Context

OrganizationServiceContext is alternative to OrganizationServiceProxy to connect to Microsoft Dynamics CRM programmatically.

To create OrganizationServiceContext object pass IOrganizationService object to constructor.

IOrganizationService service = new OrganizationService("connection");
OrganizationServiceContext context = new OrganizationServiceContext(service);

Entity entity = new Entity("account");
entity.Attributes["name"] = "This is my sample account";

context.AddObject(entity);
context.SaveChanges();

context.AccountSet.ToList().ForEach(a => Console.WriteLine(a.Name));

OrganizationServiceContext class can be generated by the code generation tool (CrmSvcUtil.exe). 

Learn more about OrganizationServiceContext.

Opportunity : Opportunity Form Fields

The opportunity form in Microsoft Dynamics CRM contains the following fields:

  • Topic: The opportunity’s interests. For example, if an existing customer called for details about a product, list the name of the product as the topic.
  • Contact: Lookup for a Contact record associated to the opportunity.
  • Account: Lookup for an Account record associated to the opportunity.
  • Purchase Timeframe: Timeframe for the potential sale of the sales opportunity.
  • Currency: Local currency for the record.
  • Budget Amount: Lead’s potential available budget.
  • Purchase Process: Whether an individual or committee will be involved in the purchase process.
  • Description: Text area for additional information for the opportunity.
  • Price List: The appropriate price list for organizations that use them. 

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.

Retrieve a Record In Microsoft Dynamics CRM Using Early Bound

Retrieve Method

To retrieve a single record use IOrganizationService.Retrieve(String, Guid, ColumnSetmethod.

Parameters

Name Type Comment
entityName String Logical name of entity
id Guid Guid of record to retrieve 
columnSet Microsoft.Xrm.Sdk.Query.ColumnSet Columns to retrieve 

Output

Microsoft.Xrm.Sdk.Entity

This method is implemented by OrganizationService class and OrganizationServiceContext generated in previous chapter.

Using Early Bound

All classes in early-bound entity classes (generated in earlier chapter) has a EntityLogicalName property which returns logical name of entity. 

Account.EntityLogicalName

Use this as first parameter in IOrganizationService.Retrieve method. Using Entity.EntityLogicalName avoids any typo error in entity logical name. 

IOrganizationService.Retrieve method returns single Entity record and can be casted to respective strongly type class to have intellisense in Visual Studio.

(Account)_service.Retrieve(Account.EntityLogicalName, _accountId, new ColumnSet(true));

Following example demonstrates how to retrieve a account record in Microsoft Dynamics CRM using Early Bound

C#

using Microsoft.Xrm.Client.Services;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System;

namespace Msxrmtools
{
class Program
{
static void Main(string[] args)
{
//"connection" = connection string name from config file"
IOrganizationService _service = new OrganizationService("connection");

//assumed guid of existing account record
Guid _accountId = new Guid("9ec0b0ec-d6c3-4b8d-bd75-435723b49f84");

Account account = (Account)_service.Retrieve(Account.EntityLogicalName, _accountId, new ColumnSet(true));

Console.Write(account.Name);
Console.Write(account.Revenue);
}
}
}

Color Grid for Dynamics 365

Color Form for Dynamics 365