web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Generate New Number Sequence for sales order invoice

(0) ShareShare
ReportReport
Posted on by 1,845

Hi,

I have a requirement to generate a new number sequence when generating free text invoice for sales order.

Ex. I have a check box in saleseditline form if check box is checked and user generating free text invoice that point of time new number sequence is generated and store in place of invoice id in all table. Like a simple invoice posting for sales order.

if that check box is not checked then its work by default as ax functionality. also no other functionality have to changed.

I am worked on number sequence only on form level i dont know how to use it class.

Any one suggest me what is the best way to complete this task.

Thank You, 

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hi Dinkar,

    You can get next number using this code:

    MyTable.MyField = NumberSeq::newGetNum(CNumberSeqReference::findReference(extendedTypeNum(MyNumberSeqEDT))).num();

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Here you go:

    community.dynamics.com/.../generate-next-number-sequence-by-x-code

  • startax Profile Picture
    1,845 on at

    Hi ievgen

    Thanks for quick prompt.

    But can you give me some more details because when i am debugging invoice posting

    SalesInvoiceJournalCreateBase\initJournalHeader()

    custInvoiceJour.InvoiceId       = this.getJournalNumber(); here i have to assign my new number sequence.

    If possible please give me some more details

    Thank You,  

  • startax Profile Picture
    1,845 on at

    Hi Vilmos,

    Thanks for reply, i am not generating number sequence by code.

    I am creating a functionality so that whenever user check check box field (as describe in question) and posting free text invoice then system use my new number sequence otherwise it works default functionality.

    Thank You.

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi Dinkar,

    You can override numberSequenceReferenceNum() method for SalesInvoiceJournalCreate class and return

    NumberSeqReference::findReference(extendedTypeNum(MyEDT)) if check box is ticked or super() if not.

    This method specify what number seq should be used for number generation.

  • Verified answer
    startax Profile Picture
    1,845 on at

    Hi Ievgen,

    I am trying as you said but not able to complete it.

    But i follow the other option created a method in salesparameter table and created a similar method  SalesInvoiceJournalCreateBase\numberSequenceReferenceNum()

    in this method i am passing my own method created in salesparameter table. Finally i am checked my condition in FormletterJournalCreate\getNumAndVoucher()  and passed custom method.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans