Friday, 27 July 2018

D365 - The attribute with AttributeId = 'Guid' was not found in the MetadataCache - MSCRM Solution Export


Error Message during solution export:
The attribute with AttributeId = <GUID> was not found in the MetadataCache.


Root Cause:
A field is deleted from CRM and the field is removed. But the related solution component reference is left behind somehow.


Fix:
Find the component related to the field and remove it.

Note: Make sure to have a back-up of DB or the Org before performing below operations. Need developer level knowledge to perform this!

Step 1: Find the missing component. Get the solutioncomponentid and componenttype by executing the following fetchxml  query after replacing the guid with the attributeid from the error message.

Note: You can XRM toolbox or C# console app to retrieve the record

<fetch top="50" >
  <entity name="solutioncomponent" >
    <all-attributes/>
    <filter type="and" >
      <condition attribute="objectid" operator="eq" value="<GUID>" />
    </filter>
  </entity>
</fetch>

Step 2: Get the "solutioncomponentid" and "componenttype"  from the result of above fetchxml query and use "RemoveSolutionComponentRequest" to remove the component.



var removeComponentReq = new RemoveSolutionComponentRequest()
{
    ComponentId = <GUID - solutioncomponentid>,
    ComponentType = <int - componenttype>,
    SolutionUniqueName = <string - solution's uniquename>
};

Hope this helps!

Thursday, 19 July 2018

{Know-how} D365 BPF - Business process flow Hide a field or Attribute using JS



Requirements are always crazy, suppose if you want to optionally hide and show a field in BPF it is possible with XRM object model. The only change is the prefix which you need to add to your attributes logical name

Xrm.Page.getControl("header_process_<field logical name>").setVisible(false);

{Know-how} D365 Advanced Find - Query users based on team - Createdby/owner/modifiedby Team




In dynamics community forum, I came across an interesting querying scenario using advanced find, the requirement is to query all leads created by a team. As we all know, all records in CRM are created by user and user is a team member in a team . Lets see how to query the same using advanced find


Advanced find => select leads in look for =>In query builder select field/related => select related "Created By(User)" => under "Created By (user)" select related "Teams" => Under "Teams" select field "Team" => select the team as your value with operator "Equals"


Hope this helps!

Tuesday, 17 July 2018

{Know-how}MSCRM Ribbon - No rows could be found for LocalizedLabel with id if LocalizedLabel were published


Lets have look into a issue I recently faced and fix for the same. Also will include other references that can help to solve root cause.

Issue:
Error while publishing a ribbon customization at localizedlabel.
No rows could be found for LocalizedLabel with id 10000000-0000-0000-0000-000000000001 if LocalizedLabel were published

Fix:

  • Include only the entities that requires ribbon customization
  • Remove the attributes - This causes localized label issue for most part
  • Remove all other components in entity which are not needed

Root Cause:

The issue seems to be with a corrupted localized label and when the attribute is included, CRM tries to publish the localized label and it breaks. 

In the below forum they suggest to remove the same using direct SQL, I would suggest to raise a ticket with MS in case if you face this issue.

Sunday, 8 July 2018

D365 - Alternate Keys for Duplicate detection



Recently, I came across few scenario's where I needed duplicate detection for some of the Primary keys from multiple systems.

MSCRM alternate Keys are handy in performing duplicate detection and the alternate keys are primarily used for simplifying Integration and Migration activities. On top it implements the unique constraint for a columns or combination of columns and this can be an robust alternate to duplicate detection rules in few scenarios.


Points to Keep in Mind while designing:

  • Alternate Key allows Null values. 
  • Alternate Keys can be composite
  • Alternate Keys can be used for upsert, retrieve, update and delete. 
  • Do not go for too many alternate keys, this may impact performance as each key will be an index in DB. Seems to be a filtered index in DB


Setting up an alternate key(Copy pasted from MS blog):
To define the alternate keys, go to Go to Settings > Customizations.. Choose Customize the System > Components > Entities > Entity <X> > Keys. Choose New. On the form, fill in the required fields (Display Name and Name) and then choose and add the fields to the key. Save the key. In the example shown here, we used the Account Number field in the alternate key definition.
Define alternate key for the account entity

Contact Form

Name

Email *

Message *