Make CRM user friendly using Dynamics 365 CRM new features

What is Issue?

This time it is not an issue but improvement in product to make CRM user friendly. Below are the common requirements from users-

1.There is always requirement from user that they don’t want to click multiple times to go to particular window. Many times happens when user accidentally clicks on look up field which opens up the record and to get back to previous record user have to navigate many areas on sitemap. Even user clicks on back button on browser it might take much time to load window again.
2.User not able to find the opportunity pipeline stage or its status.
3. Activities in CRM hard to manage with external calendar.

The Reason-

These are the basic requirements from the users. Previously Dynamics 365 didn’t had any option to figure out these multiple click issue and single view to manage opportunities and Activities with calendar.

Solution-

With Dynamics 365 -2020 Release Wave 1 Microsoft provided some features that will help us with our above requirements –

1. Multiple clicks-
How we avoid multiple clicks-
Microsoft provided new event for lookup fields-  addOnLookupTagClick
Using this event we can perform action when click on lookup field record.
To avoid multiple clicks we can open record in popup window with all buttons and functionality available for that record without closing parent record window.
How to use addOnLookupTagClick event-

//call function onload of form with execution context passed.
function LookupDialog(executionContext) {
    var formContext = executionContext.getFormContext();
    formContext.data.entity.attributes.forEach(function (attribute, index) {
        var attributeType = attribute.getAttributeType();
        if (attributeType == "lookup") {
            var attrName = attribute.getName();
            OpenDialogForLookup(formContext, attrName);
        }
    });
}

function OpenDialogForLookup(formContext, lookupField) {
    formContext.getControl(lookupField).addOnLookupTagClick(context => {
        context.getEventArgs().preventDefault();
        const lookupTagValue = context.getEventArgs().getTagValue();
        Xrm.Navigation.navigateTo(
            {
                pageType: "entityrecord",
                entityName: lookupTagValue.entityType,
                formType: 2,
                entityId: lookupTagValue.id
            },
            {
                target: 2,
                position: 1,
                width: {
                    value: 70,
                    unit: "%"
                }
            });
    });
}

Add the LookupDialog function on load event of form so that it will add this addOnLookupTagClick  event to all lookup fields on form. So that you don’t have to add this manually for every lookup field. If you have large number of lookup field then you can call this function asynchronously on form onload event.

After clicking on lookup field you will see window like below-
NewFeatures0

You can change the position like quick create window in UCI – change position: 2
and you can change the popup window screen coverage by changing –width: {
value: 50,
unit: "%"
}
in above code.
Below is screenshot for the same-
NewFeatures2

2.Opportunity Stages and Status in single view-
Microsoft introduced the new Kanban Control

that can be used to show opportunities based on their stages or status in single view with capability to move records from one stage to another.
NewFeatures3
How to activate this feature – Click here
This will give user a better view of opportunities in his bucket.

3.Calender Control-
Microsoft also provided new calendar control to manage activities as well as some entities which sticks to the time.
NewFeatures4

This can be also activated like Kanban control above.
This will help user to easily organize activities/records with calendar.

 

Hope this will help…
Enjoy Ms CRM!!!

Follow on Facebook- FB: MSCRM16Tech

 

How to get event for ‘x’ button of openConfirmDialog()

What is Issue?

While using openConfirmDialog in Xrm, you will be always able write the logic according to ok and cancel button. But some times ‘x’ button will get ignored while development and which will results into code loophole. Also there might be situation when you have to write different logic on ‘x’ and ‘cancel’ button. So how to get the ‘x’ button event?

The Reason-

Microsoft has provided the documentation for openConfirmDialog () with ok and cancel button description. But might be forget to write about ‘x’ button or might be they functionality was inprogress while it was documented.

Solution

If you know ,you can write success callback and error callback function to openConfirmDialog ().then(success(),error());

Success callback function holds the response from user, whether he confirmed or canceled this action. Using same function we can handle ‘x’ button event.

The user response to the confirmation as below-

  • Press Ok : success.confirmed
    =true
  • Press Cancel: success.confirmed
    = false
  • Press ‘x’ : success.confirmed
    = undefined

So in success callback function, use proper conditions to handle logics on these buttons available on openConfirmDialog.

Now according to above code, if I press ‘x’ the result will be as below-

Hope this will help…

Enjoy Ms CRM!!!

C#: Unable to connect Dynamic365

What is the issue?

While coding with C#, developers struggles to connect with Dynamics 365. OrganizationService/ OrganizationServiceProxy object contains null and connection fails.

The Reason-

The reason behind this issue –
1. dll support
2. Wrong Connection String
3. Configuration settings
4. SSL/TLS setting

Solution-

solution according to the reason-
1. dll Support-
You should know which dlls are supported to connect Dynamics 365.
Many times the CRM versions differs and due to CRM upgrades the dlls used becomes outdated for new Versions. Currently many developers faces this issue if you are using Dynamics365 online version . Current version of CrmSDK is V9.0.0.7. and this should be used.
You can add reference of CrmSDK by using Nuget Package Manager-

NuCrmSDK

You can change the version according to recent updates by Microsoft.
2. Connection String-
Wrong connection string might be the problem and for Dynamics 365 online version you can use connection string like-

"https://<YourOrgName>.api.<CRMRegion>.dynamics.com/XRMServices/2011/Organization.svc"

<YourOrgName>– This is your Organization Name.
<CRMRegion>– This is the Region you choose while creating organization.

Also you can find this string navigating Customization-> Developer Resources in Dynamics 365.

Other way to connect CRM is providing each parameter Separately like-

 Microsoft.Xrm.Tooling.Connector.CrmServiceClient conn = new CrmServiceClient(uName, pwd, "NorthAmerica", _crmOrganizationName, isOffice365: true);

Also you need to provide Username and password(converted to secured password) Properly.
3.Configuration Settings-
Many times application throws an exception like “Metadata contains a reference that cannot be resolved” .
You provides the connection string properly, every thing is correct but still you found the OrganizationService/ OrganizationServiceProxy showing null.
This happens in some particular domain networks. In this case you have to enable the Proxy setting and for this add the following tag under the configuration tag to your Web.Config /app.config file-

<system.net>
<defaultProxy useDefaultCredentials=”true” enabled=”true”>
</defaultProxy>
</system.net>

This will only use the credentials provided by you in connection string.
4. SSL/TSL settings-
Your application fails to connect Dynamics365 CRM if it is using some particular security protocol. To connect successfully , you need to explicitly mention the security by adding the following line just before the connection establishment lines-

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Use Tls12/SSL/Tls11 according to security protocol used by Dynamics365 .

Hope this will be helpful to connect your organization.