Design approach 3 - How to placed a button inside the form.

Requirement – Placed a button inside the form. On click of that button will open a child popup window and set the filter criteria. Upon closing the popup window, the criteria will be stored in parent window.

 Approach

Step 1: Create a field (Name: textField1) with data type Single line of text box.
Step 2: Drag this field to form on which section required to display button.
Step 3: In the field properties, Unchecked the label text box. So only the text box will be appeared on form.
Step 4: On form add one more text field ( Name : textField2)  which you want to capture the data set on popup window.
Step 5: Form load event call ButtonCreate method.
               
Function ButtonCreate(textField1) {

    var buttonfield = document.getElementById(textField1);
    if (buttonfield == null)
buttonfield = parent.document.getElementById(textField1);

    if (buttonfield != null) {
        var parentDiv = buttonfield.parentNode;
        var parentTd = parentDiv.parentNode;
        var parentTr = parentTd.parentNode;
        parentDiv.removeChild(buttonfield);
        var div = document.createElement("div");
        div.style.width = "19%";
        div.style.textAlign = "right";
        div.style.display = "inline";
 div.innerHTML = '<button id="textField2" type="button" class="ms-crm- Button" >Edit</button>';
        parentDiv.appendChild(div);
        parentTd.style.display = 'block';
        parentTd.visible = 'true';
        parentTr.style.display = 'block';
        parentDiv.style.display = 'block';

        var newField = document.getElementById(textField2);
        if (newField == null)
newField = parent.document.getElementById(textField2);
        newField.onclick = function () {onnewbuttonclick(); };
    }
};

function onnewbuttonclick() {
var fetchxml = Xrm.Page.getAttribute("new_textfield2").getValue();
var typecode = Xrm.Page.getAttribute("new_entitytypecode").getValue();

       if (!typecode || typecode == '') {
        return;
       }
var dialogurl = '/Tools/ViewEditor/Dialogs/SetFilters.aspx?entityCode=' + typecode;
       var dialogOptions = new Xrm.DialogOptions();
       dialogOptions.width = 600;
       dialogOptions.height = 600;
       var argments = {};
       if (fetchxml && fetchxml != '') {
        argments.sFetchXml = fetchxml;
       }
       var sFeatures = "dialogHeight: " + 600 + "px; dialogWidth: " + 600 + "px;";
       Xrm.Internal.openDialog(Mscrm.CrmUri.create(dialogurl).toString(),
           dialogOptions,
           argments, null,
           function (result) {
 if (result)    Xrm.Page.getAttribute("new_textfield2").setValue(result.sFetchXml);
           });
};

Design approach 2 - Based on security role enable/disable a sitemap link.


Requirement - Under a module sitemap appear a link which will access the external data. Apply security to the page link, only authorized user can access.

What are the steps to do to achieve this requirement?

Split the requirement into small segments.
1.       Create a page and access external data
2.       New page link map to sitemap.
3.       Apply security to new page link.

Create a page and access external data

Create a new HTML web service and fetch data by 
1.       If external data expose by REST, using JavaScript / Jquery access the external data and populate.
2.       If external data expose by SOAP, creates a WCF intermediate project which will call the external data and return OData output to CRM.

New page link map to sitemap and Apply security to new page link.

1.       Edit the sitemap using sitemap editor or xml file.
2.       Add a subarea and set the web resource URL. And add privilege tag set to an entity

<SubArea Id="new_URLname" Description="URL NAME" Title="URL with Authorization" Url="$webresource:URLpath.." Client="Web">
    <Privilege Entity="entity schema name" Privilege="Read" />
</SubArea>

3.       Permission grant to entity. Based on it will be accessible to users


     Sitemap sample xml structure

      <Area URL="string" ID = string ShowGroups = true/false>
      <Titles>
        <title LCID = string title=string>
      </Titles>
      <Descriptions>
        <Description LCID=string Description = string>
        </Description>
        <Group Description=string DescriptionResourceID =string Icon=string                           Id=string         Isprofile=[0|1|true\False] License = string                           Resourceid=string        Title=string URL = string>
          <Titles/>
          <Descriptions/>
          <SubArea Available=string Offline=string client=string Entity=string                           DescriptionResourceID =string Icon=string Id=string                                     Isprofile=[0|1|true\False] License = string Resourceid=string                           Title=string URL = string>
            <Titles/>
            <Descriptions/>
            <Privilege/>
          </SubArea>
        </Group>
      </Area>


Design approach 1 - Approval process scenario, where is the safest place to store the approver names


Let assume you are working in an approval process project. 

There is a requirement..
1. Approvers are change very frequently. 
2. Customer demands approver name changes should be audit-able. So, any circumstance get to know who the previous approvers was. 
3. Only administrator can change the approver, [ when the administrator gets a proper approved email from higher authority (offline process)].

How to design this requirement?

When we will design this requirement, we may find multiple approaches to do.  Like

Approach 1:
Create a new entity and manage approver names mapped to user entity. And only provide the access to administrator.
Approach 2:
Create an action, for each approver add Action Step which will return configured approver user name.
Approach 3: 
Create a configure entity and store all the approver user with a comma separated refer to key for access. [For security reason can encrypt the values. when administrator change the value using the tool decrypt and encrypt. ]

All above 3 approaches justify the requirement but approach 2 is best for security, auditing , maintenance point of view

Important tools for dynamics CRM development and data migration


Few important tools are mentioned below which helps at time of CRM development.

1.       Software Development Toolkit

This is a visual studio integrated tool. Its available in SDK. Using this tool can create, build and deploy CRM custom components like plug-in, workflow, web resources.

Microsoft provide this tool within SDK package. Also, this tool comes with different version compatibility with visual studio version.

2.       Plugin Registration Tool

This tool helps to register the plug-in or custom workflow into CRM. Also, this tool having great capability to helps debug both on-premise and online plug-in or custom workflow

This tool also be part of the SDK package.

3.       CRM configuration migration

This is another great tool provided in SDK. This tool helps to create schema, Export or Import data from the CRM environment.

4.       Deployment Manager

This tool appears in window start menu after completion CRM installation.
It helps to manage organization or import existing organization, Manage servers and authorization.

5.       XRM Toolbox

This toolbox contains lot of tools. Which helps on CRM development as well migration activity.

6.       CRMSVCUtil
7.       Ribbon Workbench
8.       Sitemap Editor
9.       Metadata Browser
10.   OData Query Designer
11.   Fetch XML Builder

Tool from #6 to #11 helps on development to generate proxy classes, manage ribbon, manage site map, build complex queries.


Few important points of Package Deployer

Microsoft Dynamics CRM Package Deployer uses the administrators to deploy packages to CRM instances.
A “package” can contain of any or all of the following:
One or more CRM solution files.
Flat files or exported data files from the Configuration Migration tool.





Dynamics CRM - Customer Service (Functional)

Service module is helping to track customer incidents and resolution process with contract boundary.

Microsoft announced to deprecate service scheduling, contract, contact line and contract template on newer version of D365.

Contract replaced with the entitlement.
Service Scheduling replaced with Universal Resource Scheduling (URS)
  
Case track issues with a focus on being "Resolved" or "Cancel". In case entity subject field is the important field which will define the categories of cases. 

Key entities: Contact, Account, Case, Entitlements, KB Article


Complete case flow will write in separate post.