locked
Identity customization in CRM 2013 RRS feed

  • Question

  • Hi,

    I have unique reference number customization in CRM 2011.  Unique reference number will be created for each opportunity when save opportunity.  I did the following to achieve this functionality.  

    1. Add new field called New_referenceNo  in opportunity form as shown in second picture.

    2. Change filed property of New_referenceNo of table OpportunityExtensionBase in sql server as shown in below screen.

    Allow Nulls No, Change Identity Specification to Yes ,Increment 1, Identity Seed 1.

    3 When save first time SQL will give the next sequence number to the opportunity in table and will update in reference Number.

    Since in CRM 2013 OpportunityExtensionBase and OpportunityBase merged into OpportunityBase table Kindly help me to do the same in CRM 2013.

    I did the following to get this but it is giving error.  Please find the details.

    Run the script to change Allow Null option to No

     ALTERTABLEOpportunityBaseALTERCOLUMNNew_referenceNointNOTNULL

    Change filed property of New_referenceNo of table OpportunityBase by design  - right click on table

    Change Identity Specification to Yes ,Increment 1, Identity Seed 1.

    But I am getting the below error when save opportunity.

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Generic SQL error.Detail:
    <OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
      <ErrorCode>-2147204784</ErrorCode>
      <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />
      <Message>Generic SQL error.</Message>
      <Timestamp>2017-03-06T05:07:52.1418066Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText i:nil="true" />
    </OrganizationServiceFault>


    pnoushu@hotmail.com

    Monday, March 6, 2017 6:33 AM

All replies

  • Use this kind of auto number is not supported by Microsoft. As a rule you cannot do operations using SQL directly. You should always use web services. You might find a lot of plugins which can do the same job. Please look into it.

    Regards Faisal

    Monday, March 6, 2017 9:57 AM
  • Hi,

    Kindly provide the link of web services for the same job.

    Regards,


    pnoushu@hotmail.com

    Monday, March 6, 2017 1:40 PM
  • Try these
    http://www.powerobjects.com/2008/05/01/auto-numbers-in-mscrm/
    
    https://www.greenbeacon.com/insights/how-to-implement-robust-auto-numbering-using-transactions-in-microsoft-dynamics-crm/
    
    http://www.encorebusiness.com/blog/dynamics-crm-auto-number-entities/
    
    https://crm2015autonumber.codeplex.com/


    Regards Faisal

    Wednesday, March 8, 2017 9:39 AM