Monday 22 January 2018

Auto Numbering in Dynamics 365 9.0



With the launch of 9.0 Release along with multiple new features one of the most awaited feature is Auto-Numbering.

What is already available currently ?

By navigating to Settings->Administration -> Auto Numbering , We can configure the auto numbering for few entities as below.



What is available from 9.0 ?



There is no new UI but using code we can create an auto-number attribute on a given entity. A console app can be written and can be executed against the CRM Org for creating this field on the Entity. Auto number can be a combination of 3 formats , 'datetime' , 'string' and 'number'.

Sample Code

public void AddAutoNumberAttrib( string targetEntity , string attribName , CrmServiceClient svcClient)
       {
            CreateAttributeRequest newAttribReq = new CreateAttributeRequest
            {
                EntityName = targetEntity.ToLower(),
                Attribute = new StringAttributeMetadata
                {
                    //AutoNumberFormat = "{DATE:[MMDDYY]}-{SEQNUM:6}-{RANDSTRING:6}",
                    AutoNumberFormat = "5-{SEQNUM:14}",
                    LogicalName = attribName.ToLower(),
                    SchemaName = attribName.ToLower(),
                    MaxLength = 150,
                    RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None),
                    FormatName = StringFormatName.Text,
                    DisplayName = new Microsoft.Xrm.Sdk.Label("Autonumberfield", 1033),
                    Description = new Microsoft.Xrm.Sdk.Label("Autonumberfield", 1033)

                }

            };
            svcClient.Execute(newAttribReq);
        }
    }

4 comments:

  1. It’s great to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read.
    Microsoft Dynamics AX Online Training

    ReplyDelete
  2. I'm very happy to search out this information processing system. I would like to thank you for this fantastic read!!Thank you for sharing wonderful information with us to get some idea about that content.

    oracle training in chennai

    oracle training institute in chennai

    oracle training in bangalore

    oracle training in hyderabad

    oracle training

    oracle online training

    hadoop training in chennai

    hadoop training in bangalore



    ReplyDelete
  3. Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me.
    Salesforce Training in Chennai

    Salesforce Online Training in Chennai

    Salesforce Training in Bangalore

    Salesforce Training in Hyderabad

    Salesforce training in ameerpet

    Salesforce Training in Pune

    Salesforce Online Training

    Salesforce Training

    ReplyDelete
  4. Stacydoe.com is the place where you can buy vouchers, coupons for all advertisement needs of online advertising.

    ReplyDelete