Wednesday, 13 December 2017

{Know-How} MSCRM JS - show or hide Navigation items using display name or Label

Code Snippet to enable or disable a tab using display name

Function to show or hide Navs


ToggleNavigationItem = function (navName,isVisible) {
    var navs = Xrm.Page.ui.navigation.items.get();
    for (var i in navs) {
        var nav = navs[i];
        if (nav.getLabel() === navName) {
            nav.setVisible(isVisible);
        }
    }
};

Usage


ToggleNavigationItem("Accounts",false); //Hide
ToggleNavigationItem("Accounts",true); //Show

Thursday, 2 November 2017

CRM 2016 to D365 - Data Migration Fix - Business process flow - The traversed path should end with the new active stage

Hello all,

Recently with a data migration from CRM 2016 to D365, we have experienced few issues related to business process.

The error message is "The traversed path should end with the new active stage"


Issue:
After doing a fair bit of analysis, found that the issue is with field called traversed path. This field contains the traversed stages in a business process flow. By default it contains a process stage value which may not be related to current business process. This field has purpose till 2016 but not sure about the significance of this field with D365 architectural changes, may be this is used at JavaScript level.

Fix:
Exclude/Unmap the field traversed path from migration and we should be good.




Monday, 23 October 2017

{Know-how}D365 Customer Engagement- Sub-grid create new record or lookup to existing



In a sub-grid on click of "+" sign, manage create of new record or lookup to existing one. This is applicable to 1:N/N:1 relationship.

Ex:
Entity1 is related to Entity2 in 1:N fashion. Entity1 will contain subgrid and Entity2 will contain Entity1 lookup


To enable create on click of "+" sign
  • Go to related lookup field in the related entity - Entity1 lookup field in Entity2
  • Customize the field and make it mandatory
  • If the field is mandatory, then automatically the "+" sign will point to create of new record

To enable add existing on click of "+" sign
  • Go to related lookup field in the related entity - Entity1 lookup field in Entity2
  • Customize the field and make it non-mandatory
  • If the field is mandatory, then automatically the "+" sign will point to existing record

Note: This behavior is not applicable to some of the OOB relationships.

Friday, 15 September 2017

{know-how} D365 CRM - Get optionset label from Stringmap using FetchXML - c#,JS, SSRS



Hello All,

Good to be back with another know how post. Lets go through a simple way to retrieve a MSCRM optionset label using fetchxml that can be used with C#/JS/SSRS.

Usual way to retrieve an optionset value in c# or JS is by using RetrieveAttributeRequest and refer this blog for the same.

RetrieveAttributeRequest - Option set label retrieval

This time, wanted to stick with old school SQL approach by using stringmap table, so replicated the same logic into fetchxml query and below is the simple fetchxml. This will be handy in SSRS report development to retrieve optionset details.

What is stringmap?
Stringmap is a table in crm which contains all the optionset options and its related details. Will write a quick article soon around stringmap and its fields 😉

Coming back to the topic, below is the fetchxml to get optionset label, hope the fields are self explanatory.

FetchXML

<fetch>
    <entity name="stringmap" >
        <attribute name="value" />
        <filter type="and" >
            <condition attribute="objecttypecodename" operator="eq" value="account" />
            <condition attribute="attributename" operator="eq" value="customertypecode" />
            <condition attribute="attributevalue" operator="eq" value="2" /> 
        </filter>
    </entity>
</fetch>

Result


<result>
    <value>Consultant</value>
</result>

Contact Form

Name

Email *

Message *