Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Code reason is required

Posted on by 920

Hi,

I want to check if the invoice number already exists on the type of Vendaccount in module : purchases> invoice journal.

1754.invoice.png

I add this code in validaWrite():

invoice = ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans,invoice)).getValue();
ledgerJournalACType = ledgerJournalTrans_ds.object(fieldnum(LedgerJournalTrans, AccountType)).getValue();

if(ledgerJournalACType==ledgerJournalACType::Vend  )
{
select ledgerJournalTrans where ledgerJournalTrans.AccountType==ledgerJournalACType && ledgerJournalTrans.Invoice==invoice;
info(strfmt("invoice %1,type %2",invoice,ledgerJournalACType));
if(ledgerJournalTrans.RecId)
{
   isValid = checkFailed(strfmt("the invoice number "+ invoice +" already exists on the type of vend account! "));
}

}

I try to add new line in invoice journal but when I save this I get error: "Code reason is required"!!

I don't know the source of error!!

*This post is locked for comments

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans