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

Wednesday, 25 April 2018

D365 CRM Solution Import - The element 'savedquery' has incomplete content -List of possible elements expected: 'LocalizedNames'



Error: 
The import file is invalid. XSD validation failed with the following error: 'The element 'savedquery' has incomplete content. List of possible elements expected: 'LocalizedNames'.'.


Background: 
When a MSCRM solution import fails at system views with "XSD schema validation failed" error 

Root Cause:
When a system view columns/filter/description is modified and added to solution. Sometimes solution export engine excludes the view(savedquery) name. I have noticed this in project service related views.

Fix:
  • Log into the environment where the solution is exported from and open the solution. 
  • Rename the view with some temporary name, then save and publish.
  • Again change the name back to it original state, then save and publish
  • Export again and re-import into destination

D365 CRM - Solution Import - Error occurred while fetching the report - SSRS



Solution Import Error:
Error occurred while fetching the report.

Background:
When a MSCRM solution import fails at reports and the error is something like "Error occurred while fetching the report"

Root Cause:
SSRS server is not up and running or having some issue. The same should also affect execution of reports in that instance. 

Thursday, 29 March 2018

{Know-how}D365 v9 Javascript - ConfirmDialog with custom labels

Below is a quick code snippet and output that can be used for customized confirm dialog

Code Snippet:
 var dialogLabelAndText = { confirmButtonLabel: "Proceed", cancelButtonLabel: "Clear & Exit", text: "This is a Confirmation Dialog", title: "Dialog" };  
   var dialogOptions = { height: 200, width: 450 };  
   Xrm.Navigation.openConfirmDialog(dialogLabelAndText, dialogOptions).then(  
     function (success) {  
       if (success.confirmed)  
         Xrm.Navigation.openAlertDialog({ confirmButtonLabel: "Yes", text: "Process completed!" });  
       else  
         Xrm.Navigation.openAlertDialog({ confirmButtonLabel: "Yes", text: "Exit and Clear Process!" });  
     });  

Output:

Thursday, 15 February 2018

D365 CRM V9 - Plugin Registration tool/SSRS/XRMToolbox connection error - Console App connection Error - TLS1.2


Wanted to pen down this for long time, but with latest info I have, it made perfect sense to share with our community regarding the recent connection errors

What is the issue?
When we try to connect to D365 V9 from Plugin registration tool, the connection fails without any proper error and loops back to organization selection screen or login screen.


What is the root cause? TLS1.2 is used in D365 V9 and older versions of TLS are not supported!
 Well document root cause available here
Some more info around TLS1.2


Available Fixes:
There can be multiple fixes to this issue, simplest one is install the latest version if available but that not an option right now.

Fix1: Get the latest version of Plugin Registration Tool my friend

The following fixes will also work with Console App/SSRS report authoring Extensions and I prefer the registry fix which seems permanent. Somehow XRMToolbox works only with registry fix.

Fix 2:This works only when fiddler is running(Temp Fix)

Note: Need Telerik Fiddler to be installed in the machine
  1. Open Fiddler
  2. Go to Tools in menubar => then select Options or Telerik Fiddler options 
  3. Open HTTPS Tab and look for the highlighted region in below image
  4. If it is missing TLS1.2, add the same by clicking it and save

Fix 3: Copied from Microsoft Article(Suggested fix - Needs Machine Restart)

  • Manually disable RC4 in TLS on systems running .NET Framework 3.5
    The following steps are primarily for customers running .NET Framework 3.5 on Windows 10 (or on Windows Server Technical Preview 3), for which an update is not available. However, for customer running .NET Framework 3.5 on all earlier affected operating systems, the manual steps serve as an optional alternative to installing the available update.
    Note These steps require the use of Registry Editor. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or view the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe.
    1. Create a text file named strongcrypto35-enable.reg that contains the following text:
      For 32-bit applications on 32-bit systems and 64-bit applications on x64-based systems:
         [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
         "SchUseStrongCrypto"=dword:00000001
      
      For 32-bit applications on x64-based systems:
          [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727]
          "SchUseStrongCrypto"=dword:00000001
      
    2. Run regedit.exe.
    3. In Registry Editor, click the File menu and then click Import.
    4. Navigate to and select the strongcrypto35-enable.reg file that you created in the first step. (Note If your file is not listed where you expect it to be, ensure that it has not been automatically given a .txt file extension, or change the dialog’s file extension parameters to All Files).
    5. Click Open and then click OK
    6. Exit Registry Editor and restart the system.
  • Manually disable RC4 in TLS on systems running .NET Framework 4.5/4.5.1/4.5.2
    Despite the fact that an update is available for systems running .NET Framework 4.5/4.5.1/4.5.2, the following steps are primarily for customers with .NET Framework 4.5/4.5.1/4.5.2 applications running on systems with .NET Framework 4.6 present. For customers running only .NET Framework 4.5, 4.5.1, or 4.5.2, the manual steps serve as an optional alternative to installing the available update.
    Note These steps require the use of Registry Editor. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or view the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe.
    1. Create a text file named strongcrypto4-enable.reg that contains the following text:
      For 32-bit applications on 32-bit systems and 64-bit applications on x64-based systems:
          HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319
          "SchUseStrongCrypto"=dword:00000001
      
      For 32-bit applications on x64-based systems:
          HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319
          "SchUseStrongCrypto"=dword:00000001
      
    2. Run regedit.exe.
    3. In Registry Editor, click the File menu and then click Import.
    4. Navigate to and select the strongcrypto4-enable.reg file that you created in the first step. (Note If your file is not listed where you expect it to be, ensure that it has not been automatically given a .txt file extension, or change the dialog’s file extension parameters to All Files).
    5. Click Open and then click OK
    6. Exit Registry Editor and restart the system.


Wednesday, 14 February 2018

D365 CRM V9 Troubleshooting TLS1.2 - SSRS report connectivity Error - Report Authoring Extensions

Recently I had to develop an FetchXML SSRS report and found that I was not able to connect to D365 CRM V9 from Visual studio. I have faced a similar issue with Plugin registration tool and the same was sorted with latest version of Visual Studio. But I couldn't find any latest version of Report authoring extensions. Planned to write a quick blog to help fellow developers

What is the issue?
When we try to connect to D365 V9 from visual studio using report authoring extensions, the connection fails without any proper error and loops back to organization selection screen or login screen.


What is the root cause? TLS1.2 is used in D365 V9 and older versions are not supported!
 Well document root cause available here
Some more info around TLS1.2

Available Fixes:
There can be multiple fixes to this issue, simplest one is install the latest version if available but that not an option right now.

The fixes will also work with Plugin registration tool/Console/XRMtoolbox

Fix 1: This works only when fiddler is running

Note: Need Telerik Fiddler to be installed in the machine
  1. Open Fiddler
  2. Go to Tools in menubar => then select Options or Telerik Fiddler options 
  3. Open HTTPS Tab and look for the highlighted region in below image
  4. If it is missing TLS1.2, add the same by clicking it and save

Fix 2: Copied from Microsoft Article(Suggested fix)

  • Manually disable RC4 in TLS on systems running .NET Framework 3.5
    The following steps are primarily for customers running .NET Framework 3.5 on Windows 10 (or on Windows Server Technical Preview 3), for which an update is not available. However, for customer running .NET Framework 3.5 on all earlier affected operating systems, the manual steps serve as an optional alternative to installing the available update.
    Note These steps require the use of Registry Editor. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or view the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe.
    1. Create a text file named strongcrypto35-enable.reg that contains the following text:
      For 32-bit applications on 32-bit systems and 64-bit applications on x64-based systems:
         [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v2.0.50727]
         "SchUseStrongCrypto"=dword:00000001
      
      For 32-bit applications on x64-based systems:
          [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727]
          "SchUseStrongCrypto"=dword:00000001
      
    2. Run regedit.exe.
    3. In Registry Editor, click the File menu and then click Import.
    4. Navigate to and select the strongcrypto35-enable.reg file that you created in the first step. (Note If your file is not listed where you expect it to be, ensure that it has not been automatically given a .txt file extension, or change the dialog’s file extension parameters to All Files).
    5. Click Open and then click OK
    6. Exit Registry Editor and restart the system.
  • Manually disable RC4 in TLS on systems running .NET Framework 4.5/4.5.1/4.5.2
    Despite the fact that an update is available for systems running .NET Framework 4.5/4.5.1/4.5.2, the following steps are primarily for customers with .NET Framework 4.5/4.5.1/4.5.2 applications running on systems with .NET Framework 4.6 present. For customers running only .NET Framework 4.5, 4.5.1, or 4.5.2, the manual steps serve as an optional alternative to installing the available update.
    Note These steps require the use of Registry Editor. Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. For information about how to edit the registry, view the "Changing Keys And Values" Help topic in Registry Editor (Regedit.exe) or view the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe.
    1. Create a text file named strongcrypto4-enable.reg that contains the following text:
      For 32-bit applications on 32-bit systems and 64-bit applications on x64-based systems:
          HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319
          "SchUseStrongCrypto"=dword:00000001
      
      For 32-bit applications on x64-based systems:
          HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319
          "SchUseStrongCrypto"=dword:00000001
      
    2. Run regedit.exe.
    3. In Registry Editor, click the File menu and then click Import.
    4. Navigate to and select the strongcrypto4-enable.reg file that you created in the first step. (Note If your file is not listed where you expect it to be, ensure that it has not been automatically given a .txt file extension, or change the dialog’s file extension parameters to All Files).
    5. Click Open and then click OK
    6. Exit Registry Editor and restart the system.


Monday, 12 February 2018

D365 CRM Basics - Understanding field types and their data types


Lets start with a basic concept of Dynamics CRM today, what are the different field types and field data types available and their basic definitions. To start with any field in dynamics falls under the below 3 categories(Except few OOB fields)

What are the types of fields/attributes I can create in D365 CRM?
  1. Simple field - Traditional field
  2. Calculated field - Based on formula and calculated on the go based on field in current record or related(lookup)
  3. Rollup field - Based on formula but used for aggregation from related records

Their handy definition from MS docs is as follows and the applicable field types types is as follow,

Field typeDescriptionAvailable field data type
Simple fieldContains data that is not based on a formula.Single Line of TextOption SetTwo OptionsImageWhole NumberFloating Point NumberDecimal NumberCurrencyMultiple Lines of TextDate and TimeLookup
Calculated fieldContains calculations that use fields from the current entity or related parent entities.Single Line of TextOption SetTwo OptionsWhole NumberDecimal NumberCurrencyDate and Time
Rollup fieldContains an aggregate value computed from the records related to a record, or a value computed over a hierarchy.Whole NumberDecimal NumberCurrencyDate and Time

What are the different data types available to configure?

D365 CRM supports wide range of data types and its better to understand all the available datatypes before settling down with one. If a field is created under certain data type, then field is locked for further data type swaps. Be wise before choosing one, else we may need to delete and recreate a field.

The field data types and their handy definitions from MS docs is as follows

Field data typeDescription
Single Line of TextThis field can contain up to 4,000 text characters. You can set the maximum length to be less than this. This field has several format options that will change the presentation of the text. These options are EmailTextText AreaURLTicker Symbol, and Phone. More information: More information: Single line of text format options
Multiple Lines of TextThis field can contain up to 1,048,576 text characters. You can set the maximum length to be less than this. When you add this field to a form, you can specify the size of the field.
Option SetThis field provides a set of options. Each option has a number value and label. When added to a form, this field displays a control for users to select only one option. When this field is displayed in Advanced Find, users can use a picklist control to select multiple options to include in their search criteria.
You can define a single, global option set and configure MultiSelect Option Set fields to use that single set of options. More information: More information: Creating and editing global option sets
MultiSelect Option SetThis field provides a set of options, where multiple options can be selected. When added to a form, this field uses a control for users to select multiple options. When this field is displayed in Advanced Find, users can select multiple options from the list to include in their search criteria.
You can define a single global option set and configure MultiSelect Option Set fields to use that single set of options. More information: More information: Creating and editing global option sets
Two OptionsThis field provides two options. Each option has a number value of 0 or 1 corresponding to a false or true value. Each option also has a label so that true or false values can be represented as “Yes” and “No”, “Hot” and “Cold”, “On” and “Off” or any pair of labels you want to display.

Two option fields don’t provide format options at the field level. But when you add one to the form you can choose to display them as radio buttons, a check box, or a select list.
StatusA system field that has options that generally correspond to active and inactive status. Some system attributes have additional options, but all custom attributes have only Active and Inactive status options.

You can also include custom state transitions to control which status options are available for certain entities. More information: Define status reason transitions
Status ReasonA system field that has options that provide additional detail about the Status field. Each option is associated with one of the available Status options. You can add and edit the options.
Whole NumberIntegers with a value between -2,147,483,648 and 2,147,483,647 can be in this field. You can restrict the maximum or minimum values in this range. This field has format options NoneDurationTime Zone, and Language that change depending on how the field is presented. More information: Whole number format options
Floating Point NumberUp to 5 decimal points of precision can be used for values between -100,000,000,000 and -100,000,000,000 can be in this field. You can specify the level of precision and the maximum and minimum values. More information: Using the right type of number
Decimal NumberUp to 10 decimal points of precision can be used for values between -100,000,000,000 and -100,000,000,000 can be in this field. You can specify the level of precision and the maximum and minimum values. More information: Using the right type of number
CurrencyMonetary values between -922,337,203,685,477 and 922,337,203,685,477 can be in this field. You can set a level of precision or choose to base the precision on a specific currency or a single standard precision used by the organization. More information: Using Currency Fields
Date and TimeThis field has format options to display Date Only or Date and Time.
ImageEach entity that supports images can have one image field. When an entity has an image field, it can be configured to display the image for the record in the application. More information: Image fieldsVideo: Dynamics CRM Image Data Type
LookupA field that allows setting a reference to a single record of a specific type of entity. Some system lookup fields behave differently. More information: Different types of lookups
OwnerA system lookup field that references the user or team that is assigned a user or team owned entity record.
Unique IdentifierA system field stores a globally unique identifier (GUID) value for each record.
CustomerA lookup field that you can use to specify a customer, which can be an account or contact.


Thursday, 11 January 2018

D365 V9 CRM SDK - SDK is reborn as Developer Guide - No more SDK download!


Microsoft is coming up with quite a bunch of sensible updates/features everyday. With the evolution around Dynamics space, we tend to witness updates around most of the existing areas and now it includes CRM SDK, 

What happened to SDK? No more SDK downloads!

SDK and the related documentations are replaced by Developer Guide . Developer Guide is a part of  docs.microsoft.com now and has all the needed documentation. 


Makes sense, but what happened to Plugin registration and other tools, bin assemblies and Sample code? 

Don't worry, Everything is still available but as standalone downloads


Where are the the plugin registration and other tools(Plugin registration tool, CrmSvcUtil, Configuration migration, Solution Packager, Package deployer, etc.,)

They are available as NuGet and can be downloaded using power shell scripts. The steps are as follows 

For more info refer this page from Microsoft docs and the below steps are copied from the same,

  1. In your Windows Start menu, type Windows Powershell and open it.
  2. Navigate to the folder you want to install the tools to. For example if you want to install them in a devtools folder on your D drive, type cd D:\devtools.
  3. Copy and paste the following PowerShell script into the PowerShell window and press Enter.
    $sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
    $targetNugetExe = ".\nuget.exe"
    Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore
    Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
    Set-Alias nuget $targetNugetExe -Scope Global -Verbose
    
    ##
    ##Download Plugin Registration Tool
    ##
    ./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools
    md .\Tools\PluginRegistration
    $prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'}
    move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration
    Remove-Item .\Tools\$prtFolder -Force -Recurse
    
    ##
    ##Download CoreTools
    ##
    ./nuget install  Microsoft.CrmSdk.CoreTools -O .\Tools
    md .\Tools\CoreTools
    $coreToolsFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.CoreTools.'}
    move .\Tools\$coreToolsFolder\content\bin\coretools\*.* .\Tools\CoreTools
    Remove-Item .\Tools\$coreToolsFolder -Force -Recurse
    
    ##
    ##Download Configuration Migration
    ##
    ./nuget install  Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf -O .\Tools
    md .\Tools\ConfigurationMigration
    $configMigFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf.'}
    move .\Tools\$configMigFolder\tools\*.* .\Tools\ConfigurationMigration
    Remove-Item .\Tools\$configMigFolder -Force -Recurse
    
    ##
    ##Download Package Deployer 
    ##
    ./nuget install  Microsoft.CrmSdk.XrmTooling.PackageDeployment.WPF -O .\Tools
    md .\Tools\PackageDeployment
    $pdFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PackageDeployment.Wpf.'}
    move .\Tools\$pdFolder\tools\*.* .\Tools\PackageDeployment
    Remove-Item .\Tools\$pdFolder -Force -Recurse
    
    ##
    ##Remove NuGet.exe
    ##
    Remove-Item nuget.exe    
    
  4. You will find the tools in the following folders:
  • [Your folder]\Tools\ConfigurationMigration
  • [Your folder]\Tools\CoreTools
  • [Your folder]\Tools\PackageDeployment
  • [Your folder]\Tools\PluginRegistration
To get the latest version of these tools, repeat these steps.


Where are the Sample codes and projects? 

They are available in the following Microsoft docs URL



Where are the assemblies? 

Assemblies are a part of NuGet package like the dev tools. Refer here for NuGet info


Hope this helps!

Source and Reference: Microsoft docs

Contact Form

Name

Email *

Message *