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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Ax 2009 purchase order posting migration to D365

(0) ShareShare
ReportReport
Posted on by 5

Hello all, i have this process defined in 2009  where we invoice selected PO lines which matches with custom table. i have to migrate this to D365 but the framework is completely changed. i am freaquently getting errorrs at different place. can anyone please share any code snipet which can help in this scenario. 

#private parmId postInvoice()
#{
# //post invoice for all matched purchase lines
# PurchFormLetter_Invoice purchFormLetter;
# QueryBuildDatasource invoiceDS;
# UserId userId = curUserId();
# ;
# purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice, true);
# purchFormLetter.reSelect(PurchUpdate::All, NoYes::Yes);
# purchFormLetter.transDate(transDate);
# purchFormLetter.interCompanyInitQueryBuild();
#
# switch (importType)
# {
# case ABC_ImportType::POInvoiceAccrual :
# invoiceDS = purchFormLetter.queryChooseLines().query().dataSourceTable(tablenum(PurchLine)).addDataSource(tablenum(ABC_POInvoiceAccrual));
# invoiceDS.addLink(fieldnum(PurchLine, ABC_LoadNumber), fieldnum(ABC_POInvoiceAccrual, LoadNumber));
# invoiceDS.addLink(fieldnum(PurchLine, ItemId), fieldnum(ABC_POInvoiceAccrual, ItemId));
# invoiceDS.joinMode(JoinMode::ExistsJoin);
# invoiceDS.addRange(fieldnum(ABC_POInvoiceAccrual, CreatedBy)).value(userId);
# invoiceDS.addRange(fieldnum(ABC_POInvoiceAccrual, HasErrors)).value(SysQuery::value(NoYes::No));
# invoiceDS.addRange(fieldnum(ABC_POInvoiceAccrual, RefInventTransId)).value(SysQuery::valueEmptyString());
# invoiceDS.addSortField(fieldnum(ABC_POInvoiceAccrual, createdDateTime), SortOrder::Descending);
# break;
#
# default : return purchFormLetter.parmId();
# }
#
# purchFormLetter.parmParmTableNum(this.parmInvoiceId());
# purchFormLetter.createParmUpdate (false);
# purchFormLetter.sumBy(AccountOrder::Account);
# purchFormLetter.chooseLines (false);
# purchFormLetter.run();
#
# return purchFormLetter.parmId();
#}

I have the same question (0)
  • MuthukumaranAX Profile Picture
    2,903 on at

    can you share the error details?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 694

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 646 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 337

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans