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


    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=, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Generic SQL error.Detail:
    <OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
      <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />
      <Message>Generic SQL error.</Message>
      <InnerFault i:nil="true" />
      <TraceText i:nil="true" />


    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.



    Monday, March 6, 2017 1:40 PM
  • Try these

    Regards Faisal

    Wednesday, March 8, 2017 9:39 AM