locked
How to control Auto-Numbering feature? RRS feed

  • Question

  • Hi,

    I want to have more control over the "Auto-Numbering" feature. For example, I want to use this formula:

    INV-DDMMYYYY-Time

    It means INV (invoice for exmple) - DD the current day, MM Month, YYYY the current year. So, it will be like this: INV-28012010-1236

    Thanks in advanced.
    Thursday, January 28, 2010 10:28 AM

Answers

All replies

  • Did you try updating the invoicenumber using plugin?

    As teh documentation says, you can update the invoice number. so what you can do is to write a Post-Create Plugin on the "invoice" entity and update this invoice number.

    As the documetnation says the invoice number can be get & set. so i beleive it can be udpated.

    invoice.invoicenumber Property

    Gets or sets the invoice number.

    Syntax

    [Visual Basic .NET]
    Public Property invoicenumber As String
    [C#]
    public string invoicenumber {get; set;}
    Thursday, January 28, 2010 11:59 AM
  • Hi i think you can get the date by using date(now) and the numbering you can do this by using an sql qeury you must ask the max number(in you examle this is 1236, the query get 1236 and add one 1237 ad the onsave event) and add one to it. and so on. Paste inv to the date and the number and then you have you unique identifier.

    The same setup you can use for making an plugin for this.
    The mind i just like a parachute, it only works when open.
    Thursday, January 28, 2010 12:33 PM
  • Hi,

    AutoNumbering features are generally quite limited in the out-of-the-box CRM. You will not be able to change the way builtin autonumbering works - you can only change the prefix and the length of sufix. If you want to have more control, you can:
    1) Write a plugin as the guys above suggested
    2) Create a db solution to store the numbers as suggested here: http://blogs.msdn.com/crm/archive/2008/05/13/auto-numbers-in-microsoft-dynamics-crm.aspx
    3) Use the CrmNumbering addin that can be downloaded for free from codeplex: http://www.codeplex.com/crmnumbering

    I hope that helps,
    Kuba
    -- Kuba Skałbania, Netwise
    • Marked as answer by Jim Glass Jr Thursday, January 28, 2010 10:00 PM
    Thursday, January 28, 2010 12:46 PM
  • It should be noted that Numbering in CRM can be overridden, if a value is provided to the appropriate "number" attribute as the record is created.  This will prevent CRM from "assigning" a new number.  It is not, however, possible to change them after they've been created, since these attributes are flagged at the core as invalid for update.  This was recently discussed on the CRM Team Blog:  http://blogs.msdn.com/crm/archive/2009/09/28/case-number-is-just-the-ticket.aspx
    Dave Berry
    Thursday, January 28, 2010 7:12 PM
    Moderator