Archives / 2017 / March
  • Keys concept in Dynamics CRM and its Usage

    • Traditionally, insert and update have always been separate requests in Dynamics CRM
    • The logic to identify whether to create a record or update a record is always to avoid such confusion the keys concept have been introduced.
    • Initially the keys concept has been introduced in the update spring release of CRM 2015.


    The keys concept is not included in previous versions of CRM.

    About Keys: 

    Keys can be called as alternate unique identifier for an entity.

    Let me provide a small example of it

    As we know that each and every record of an entity has an unique identifier named as Primary Key(GUID)

    This GUID is used to identify a record based on its uniqueness.

    So the key will serves as an alternate key for the record in order to identify based on the uniqueness of field.

    This keys is completely field related.

    For each entity the maximum number of keys(alternate keys) cannot be more than 5.

    The keys support only 3 data types in CRM

    • Single Line Text
    • Decimal Number
    • Whole Number


    Usage of Keys in Dynamics CRM:

    The keys concept will be useful in dynamics CRM when we use the UPsertRequest

    So to get clarification about keys, we have to know about the UPSERT request and how it will be benefited to us

    UPSERT Request:

    The UPSERT request is the request which is of the combination of insert(create) and update in CRM

    EX: suppose if we have some data which is to be placed in an entity in CRM. But we don’t know whether the data has already been created in CRM or not.

    So in order to avoid those confusion state the UPSERT command will takes a prominent role.

    • It returns Boolean value of “response.Record Created” as either true or false
    • If it returns true then, a record is created in CRM with the specified data
    • Else it updates the existed record in that entity based on the keys we are provided.


    Brief example about creation of keys and the usability of it in dynamics CRM

    How to create keys:

    clip_image001Go to settings –> customization

    clip_image002Default solution Entity to find a new “Keys” tab added along with Forms and Fields tabs.


    Fig: key creation in entity

    • As the initial stage is to create an alternate key in entity with respective data types that it supports
    • When you click on keys it opens a select new button.
    • Then it opens a page which shows you the list of available attributes of that entity that supports the keys.
    • Then select the field that you want to make the specific attribute as alternate key to that entity.
    • Now we have some specific data which is to be inserted in that entity
    • Since the point is we don’t know whether the data is already existed or not in that entity

    Here the UPSERT request plays a significance role


    // defines the Alternate key which uniquely identifies the record

    KeyAttributeCollection testkeys = new KeyAttributeCollection();

    testkeys .Add(“new_emailaddress”,””);

    // create Test Custom entity object by specifying the entity logical name and Alternate key

    Entity testCustomEntity = new Entity (“new_testcustomentity”, testkeys);

    // specifying fields to update

    testCustomEntity ["new_name"] = “SAMPLE TEST123″;

    testCustomEntity ["new_houseallowances "] = 12.6;

    testCustomEntity ["new_hobbies"] = new OptionSetValue(100000005);

    // Creating Upsert request

    UpsertRequest upreq = new UpsertRequest();

    upreq.Target = testCustomEntity;

    // Executing Upsert request

    UpsertResponse response = (UpsertResponse)_service.Execute(upreq);

    When we execute the above code, then the UPSERT request will checks whether the entity contains the specified key data

    The request has a property named target which takes the entity object along with the key that was specified

    If any record exists with the specified email address in the above code,, then the request returned response(RequestCreated) will returns to false

    So the update request will be executed and the record is updated with the specified values

    The output will be given below




    So in this way the UPSERT request works in dynamics CRM

    Benefits of Keys:

    1) Create or update record in a single call

    2) No duplication of data is allowed.i.e. If we create another record with the same email address that specified above it will arises the business process error that the attribute with data has already existed. Provide some unique value.

  • Enhancements in Business Rules in Dynamics 365

    Business rules initially introduced in 2013 and after that enhanced these business rules .

    In Dynamics 365, business rules design changed with completely new look.

    Drag and drop feature introduced in new business rules design. Now you can add actions and conditions by dragging from component tab. Business rules new look as shown in below screen shot.



    Business rule has new toolbar itself which as following buttons.

    Add and Delete: It can be used to Add and remove actions and conditions from business rule.

    Cut Copy and Paste: These buttons used to reuse purpose.

    Snapshot: Snapshot button is very helpful in preparing document when these business rules screenshots in document.

    Tick Mark: Check mark in the above Screen shot indicates IF or true condition and X Cross mark indicates else or false condition.

    So we can drag and drop the components on both the end parts of the condition.


    Business rule design area have mini map to navigate quickly part of the business rule and display the overall coding part here.

    Validate button: This button appear on command bar which is used to check that business rule valid or not before publishing. If any issues in business rules, it will show error message highlighted with red color. These buttons as shown in below screen shot.


    Component bar and Properties bar:

    Component bar contains conditions and all actions. If you place condition or action on business rule area it will configure its properties using property tab. Components and Properties tabs as shown in below screen shot.

    Component bar:


    Properties bar:




    Recommendation is new Action in Business Rules. It is helps in recommending a field value to the users based on condition specified and avoiding data entry errors. Let’s see below example

    If you select category as standard, you will recommend lower credit limit.

    Navigate to business rules in two ways one as follows

    Navigate to settings –> customizations —> customize the system expand required entity and then select Business Rules. Other one is open required entity form then click on Business Rule button on top of the ribbon bar.

    Select default condition fills the following properties then click on Apply button as shown in below screen shot.


    Drag and drop the Recommendation Action next to condition and configure its properties as shown in below screenshot.


    After fill the following details click on Apply button. Click on Recommendation new Action in business rule design area and configure its properties and click on Apply shown in below screen shot.


    After completion of business rule, click on Save button and click on Activate button as shown in below screen shot.


    Go to Account entity and open any one record to check this example. If you select Category field as Standard then exclamation mark appear next to the Credit Limit.

    This recommendation Action like field Settings “business recommended” but business recommended indicates with +Sign and it does not provide any additional information for that.

    Click on this mark show recommended notification click on Apply button to set data. As shown in below screen shot.


    After click on Apply button, value set to field as shown in below Screen shot.


  • Enable Editable Grids in D365

    Editable Grid is a feature which is introduced in Dynamics 365, it’s an inbuilt add on by Microsoft in Dynamics 365.

    The Inline editing feature provided by Editable Grid is very useful in case of bulk editing within a short time period.

    Editing is provided on both Home Grid and Sub Grid

    Read-only grid

    • By default, when you create any custom entity or any OOB entities, editable grid is not configured.
    • By default, read-only grid is shown to the users.
    • You cannot disable read-only grids on any entity. You can choose which one to show by default i.e. either read-only or editable grid.


      To configure the editable grid follow the steps

    • Let’s make Account Entities Grids as Editable here.
    • Open Dynamics 365
    • Navigate to Settings clip_image002
    • Click on Customizations clip_image004
    • Click on Customize the System


    • Customization window will be populated, there in Solution Default Solution Expand the entities by clicking on arrow button
    • And click on Account Entity
    • To make Home Grid as Editable
    • In the right side panel it opens the properties related to the Account Entity as follows
    • Click on Controls tab on the right panel (Properties of Entity)



    • Click on Add Control, the following window will be populated, here click on Editable Grid
    • Then the properties will be shown below the Editable Grid like Modes, Types



    • Click on Add, then the properties will be added to the window as below



    • Editable Grid properties can be customized on clicking of the clip_image013 pencil button
    • Save and Publish the Customizations.
    • Navigate to Sales –Account.
    • Before these customizations, the Account Entity contains the following buttons on the Home Grid



    • After the Customizations, SHOW AS clip_image016 button will be enabled, which is having the options Read-only Grid and Editable Grid


    • On Click of Editable Grid button
    • The Grid will be enable for editing as follows


    • The cells in the table can be edited and saved by clicking on the save button top right corner of the grid.


    Sub Grid as Editable

    • Open a Form Editor of Account
    • There are two ways to open form editor, one is from the settings à Entity à Forms and other one is Entity à Record à Form Editor
    • Account will be having Contact Sub Grid.
    • To make that sub grid editable
    • Open that sub-grid’s properties
    • Click on Controls à click on Add Control
    • The following panel will appear, select Editable Grid and Click on Add button


    • The Control will be added to the Sub Grid, Customizations can be done to the control in properties panel



    • Select where you want to see these changes, like web phone and Tablet


    • Click on Ok button
    • The Save the form and Publish it



    • NOTE: The link attribute between two entities should be on the selected view in the Grid view of editable Grid Properties.
    • Refresh the Record, then the Sub Grid becomes Editable as follows


    • The save functionality is same as Home Grids save functionality.
    • Editable grid also works on same security model. I.e. if user does not have write access on the record, then editable grid does not allow users to update the record.
    • Field level security works in same way in editable grid as well.
  • System Entities in Dynamics 365

    In Dynamics CRM the modules were represented as a vertical navigation area in CRM 2011 and was reworked into a horizontal, partly collapsible navigation bar in CRM 2013. Starting with CRM 2015 SP1, which was only available online, and now in CRM 2016 the horizontal navigation bar now expands to reveal both areas as well as related entities.

    Modules in dynamics CRM are as below.

    1. Sales

    2. Service

    3. Marketing


    Sales module further contains the following system entities.

    i. Accounts

    ii. Contacts

    iii. Leads

    iv. Opportunities

    v. Competitor

    vi. Invoice

    vii. Order

    viii. Quote


    The account entity is one of the entities in Microsoft Dynamics 365 to which most other entities are attached or parented. In Microsoft Dynamics 365, an account represents a company with which the business unit has a relationship. Account can have only one account as its parent, accounts can have multiple child accounts and child contacts.


    A contact represents a person, usually an individual, with whom a business unit has a relationship, such as a customer, a supplier, or a colleague.

    The contact entity is one of the entities that most other entities are linked to, contact can be a parent to every other entity except accounts and contacts. The contact entity stores all information about a person such as an email address, street address, telephone numbers, and other related information.


    A lead entity represents an individual that is identified as someone who is interested in receiving specific information about the products or services offered by the company.

    A lead is used to track contacts or accounts that are potential customers, but who have not yet been qualified.

    A lead is kept separate from customer and opportunity data until the lead is qualified.


    The opportunity entity represents a potential sale to new or established customers. It helps you to forecast future business demands and sales revenues. You can create a new opportunity in Microsoft Dynamics 365 to monitor an inquiry from your existing customer.

    An opportunity must be associated with one account or contact. An account and a contact may have links to multiple opportunities.


    A competitor is another company that offers competing products and services. Each competitor record in Microsoft Dynamics 365 can contain detailed information about the competitor that includes a company profile.

    With competitor tracking, you can find competitors and analyze their sales strategies, their products, and what contracts they win. This functionality includes adding and maintaining competitor records, and storing competitor documents.


    A quote is a formal offer for products or services proposed at specific prices and related payment terms that is sent to a prospective customer. A quote can have a due date, effective dates, and the requested delivery dates. If a quote is created from an opportunity, Dynamics 365 will use the products associated with the opportunity as the basis for the draft.


    A sales order (order) is a quote that has been accepted. This entity is called “order” in the Microsoft Dynamics 365 application. The schema name for this entity is Sales Order.


    An invoice is an order that has been billed. The schema name for this entity is Invoice.

    Service Management:

    One of the more powerful but often overlooked features of Microsoft Dynamics CRM is the Customer Service module, which allows you to manage and track customer service activity in your organization. Apart from Accounts and Contacts there are few more entities in Service Module.

    1. Cases

    2. Knowledge Base

    3. Contracts

    4. Entitlement Entities

    5. Queues

    6. Calendar

    7. SLA KPI instance


    The Case entity provides incident-based tracking for issues that may arise from customers. It is designed to track the process from the initial intake of an incident, tracking the details throughout the remediation process, and through final resolution. You can assign cases to CRM users or teams.

    For more powerful automation and collaboration, cases can also be added to queues. By using the incident management APIs, you can create reports to measure statistics, such as individual customer service representative statistics and the average length of time that incidents remain active.

    Knowledge Base:

    Microsoft Dynamics 365 (online & on-premises) introduce a new knowledge management system that lets you create rich knowledge articles with support for embedding external multimedia contents, such as images and videos, as links.

    You can use the SDK to programmatically create and manage knowledge articles, create major and minor versions of the articles, translate the articles into multiple languages, and schedule the publishing and expiration of the articles.

    After you enable knowledge management for an entity using the web client, you can insert and configure a knowledge base search control in the entity form to display relevant knowledge articles from Dynamics 365.


    A contract is an agreement to provide support during specified coverage dates or for a specified number of cases or length of time. The contract entity is used to track customer service agreements.

    You can create contracts for existing customers that specify the type of service and terms that apply to each customer. New contracts are created based on the contract template. You can create contracts only for existing accounts and contacts. A contract has the status of “Draft” until it is invoiced. You can change the contract template until the contract status changes. Each new contract is assigned a unique ID that can’t be used for another contract unless it is being renewed.

    Entitlement Entities:

    Entitlements specify the support term based on number of hours or number of cases. The customer’s support level can vary based on the product or service that the customer has purchased. Customers who’ve purchased different products can be entitled to different support levels.

    This information helps the customer support agents verify what the customers are eligible for and create cases for them accordingly. Use entitlement templates and entitlement template channels to create entitlements prefilled with the basic information like the start and end date, service level agreement (SLA), allocation type, and total term.


    Queues are instrumental in organizing, prioritizing, and monitoring the progress of your work while you are using Microsoft Dynamics 365.

    As a central location for work management, queues assist you in processing cases, responding to service calls, or sending out product information to prospective customers. Programmatically, a queue is a collection of queue items. A queue item serves as a container for an entity record, such as a task, an email, or a case that needs processing.

    Customizable entities can be enabled for queues, Queues may be public or private. Private queue items are only visible to the members of the queue, private queue is automatically created for each new user or team. A queue can contain multiple entity types, such as tasks, emails, or cases. This helps improve productivity and track the entity and attribute data changes for future analysis and reporting.


    The Service Calendar is separate from the other CRM Calendar. This is where all the scheduled Service Activities appear. By default the Service Activities that you own will sync to your Outlook calendar if you have the Outlook Client installed.

    SLA KPI (Service Level Agreement Key Performance Indicator):

    Define the level of service or support that your organization agrees to offer to a customer by using service level agreements (SLAs) in Microsoft Dynamics 365.

    Include detailed items to define metrics or key performance indicators (KPIs) to attain the service level. KPIs help you get timely warnings on your team’s issues while providing support. You can associate an SLA with an entitlement so that when an entitlement is added to a case, the associated SLA is also applied. You can associate only SLAs that are created for the Case entity with entitlements.

    Marketing Entities:

    The marketing entities let you perform detailed campaign planning, manage the creation and execution of a campaign, and assess a campaign's performance.

    Following are the Entities in Marketing Module

    1. Campaign

    2. List


    A campaign in Microsoft Dynamics 365 is designed to accomplish a specific result, such as introducing a new product or increasing market share. The main way to accomplish this result is through communicating the benefits of a product or service to people and businesses. Campaigns often include more than one communication method, such as print advertisements, promotional discounts, and direct mail.

    A campaign can be thought of as a container in which a business keeps planning tasks, campaign activities, and campaign responses. It has a list of related products, sales literature, and a set of marketing lists of existing or potential customers. This information is used to plan and track the results of a marketing campaign throughout its life.


    In Microsoft Dynamics 365, list management and the list (marketing list) entity help you create lists of potential customers or existing customers for marketing purposes. Typically, a list is a potential target for a campaign. There are two types of lists: static and dynamic.

    Static: To add the members to a static list, use the Microsoft.Crm.Sdk.Messages.AddListMembersListRequest message.

    Dynamic: The members for a dynamic list are selected dynamically based on the Fetch XML query criteria during distribution of a campaign activity or a quick campaign.

  • Creation of Dialog in Process in Dynamics 365

    The creation of a Dialog in process using Dynamics 365.

    Step 1: Open the Dynamic 365.


    Step 2: Navigate to Sales –> Settings –> Process Center –> Process


    Step 3: Click On Process and you will the same screen as below image.


    Step 4: Click on New Button to create the new process.


    1. Provide the name of the process, in this example “DIalogFirst” is the name of the Process.

    2. Select the Category as Dialog.

    3. Select Any 0ne Primary Entity. Click Ok.

    Step 5: A Pop Window is opened, make sure that process must run on “on demand process”.


    Step 6: Right Click on the steps and click on add steps, In that select Page.


    Step 7: provide a Unique Name in the Description, for example it is named as “Page1”.


    Step 8: Click On the page row and click on Add step, select “Prompt and Response” as below.


    Step 9: After Selecting the Prompt and Response, Enter the Description in description bar and click on set properties.


    Step 10: Enter the prompt details like prompt text and tip, moving on to response details, select Response type as single line text, data type as text and select radio button Yes for Log Response. Default value is left blank.


    Step 11: Click on Save and Close.


    Repeat the steps from 8-11 by creating prompt and responses.

    Step 12: How to Work With an Option set, creating the prompt by preferences.

    1. Select the response type as Option set(pick list).

    2. Response type as Integer.

    3. Log Response as Yes by checking the Radio button.

    4. Add the items providing with values to the option set.

    Step 13: Click on Save and Close button.


    Now Update the Record, select the page and click on “Add Step”, select the “Update Record”.

    Step 14: You can see the step just below the page.

    Step 15: Click on Set Properties, of update record as follows.


    You can see the following image 

    Step 16: Based on prompt and response, mouse focus should be placed on the fields.


    Go to look for and pick the prompts created, click on “Add” and click “OK”.


    Step 17: Select the option set from local values and place the focus into the field but do not select any option set. Click on Add and Ok.


    Step 18: Click on Save and Close.


    Step 19: To Test save and Activate the process.


    Step 20: A Pop Window is opened for confirmation whether to Activate or Not?


    Step 21: Go to Advanced find and, and select the “Lead” as entity and search for the records.


    Step 22: Open the record, and click on the extension and click on the “Start Dialog”.


    A new pop-up window is opened and asks to select the dialog to run, select the Dialog and Click on Add Button.

    Step 23: Finally You can see a new window is opened with prompt and response, and enter the details and click next and finish.


    Click on Finish Button.


    Step 24: Refresh the record to update the values.


    Finally the Updated Values can be seen here.


    This is how the Dialog process works.

Please Wait