Sample Code for Autonumbering in Dynamics 365 July 2017 Update


As a first step, add references to the latest version 9 assemblies

https://www.nuget.org/packages/Microsoft.CrmSdk.CoreAssemblies/

In the below sample code, we are creating an Auto number attribute in Contact Entity.

This is how the fields shows up inside contact form.

Using UpdateAttribute Request we can update the format for the AutoNumber field.

And also, we can have multiple auto number fields for an entity as shown below.

Sample Code


CreateAttributeRequest createAttributeRequest = new CreateAttributeRequest();
createAttributeRequest.EntityName = "contact";

var autoNumberAttributeMetadata = new StringAttributeMetadata()
{
AutoNumberFormat = "Auto Number - {SEQNUM:4} - {RANDSTRING:4} - {DATETIMEUTC:yyyyMMddhhmmss}",
SchemaName = "new_autonumber1",
MaxLength = 100,
RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.ApplicationRequired),
DisplayName = new Microsoft.Xrm.Sdk.Label("My Auto Number", 1033),
Description = new Microsoft.Xrm.Sdk.Label("This is my first auto number field through SDK", 1033)
};

createAttributeRequest.Attribute = autoNumberAttributeMetadata;
var response = organizationService.Execute(createAttributeRequest);

And now the simplest and best way to create these Auto Number fields à

Using Auto Number Manager developed by Jonas Rapp, Microsoft MVP.

https://www.linkedin.com/pulse/auto-number-attributes-microsoft-dynamics-365-jonas-rapp/

https://www.xrmtoolbox.com/

https://github.com/MscrmTools/XrmToolBox

Hope it helps..

Microsoft.CrmSdk.CoreAssemblies Version 9.0.0.5 available now


Finally, we have the new assemblies available 🙂

https://www.nuget.org/packages/Microsoft.CrmSdk.CoreAssemblies/9.0.0.5

new_sdk

Dynamics 365 Relationship Insights-An error has occurred. Error ID :: InvalidTenantProductId in Dynamics 365 July 2017 Update


While trying to configure Relationship Insights in Dynamics 365 July 2017 Update

I am getting the below issue.

Is anyone else facing the same ?

Members Count field not getting updated on converting Dynamic Marketing List to Static Marketing List – issue in Dynamics 365 July 2017 Update


While trying out few things in July 2017 update of Dynamics 365, we encountered a strange issue.

The members count field was properly in case of Static Marketing List, however, while converting the Dynamic Marketing List to Static (using Copy To Static), this field was not getting populated.

And also, the field was getting unlocked in case of Update Form for both Static and Dynamic Marketing list, unlike earlier version where this field was always locked on Form.

The field properly calculating count and locked in case of earlier versions.

Hope it helps..

“Does not contain data” filter in Advanced Find in Dynamics 365 July 2017 Update


With July 2017 Update in Dynamics 365, Advanced Find view now supports Does Not Contain Data filter for related record.

So basically, we can now write a query like “Find all the lead records which doesn’t contain any related task”. However, we cannot define any filter conditions for the related record though.

The other interesting thing that we observed that in the case of N – N relationships it throws exception.

For e.g. if we want to find all the contacts that are not associated to marketing list

We get the following exception à

Also,

The does not contain data filter isn’t available while defining marketing list members in marketing list.

Hope it helps..

Fixed – Incorrect attribute value type System.String in Dynamics 365 (CRM)


We were getting the below error while creating an entity record through a C# Console Application.

This occurred because the code was trying to set string value to one of the decimal type field.

Parsing the string value to decimal and then setting it fixed it.

Hope it helps