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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Credit note settlement causes wrong conditional sales tax posting X++

(0) ShareShare
ReportReport
Posted on by 8

Hello,

I am having issues with conditional sales tax posting.

The scenario is next:

I have invoice (ISV table, not standard) which has lines with conditional sates tax code.

I post the invoice.

Then I have a function which I use to create a credit note and it gets automatically settled.

It works fine, everything gets posted and settled.

Then, when I run standard Settle and post sales tax and go to Trial balance, I see disbalance, an extra posting has been created for conditional sales tax that shouldn't be created.

When I do the same process with standard invoice and credit note it is ok. So I assumed that something is wrong with our function for auto settlement, so when I remove that code, transactions are not settled but when I manually settle, postings are ok.

My code for auto settle is:

CustTable custTable;
CustTransOpen custOpen;
CustTrans settleTrans;
CustTransOpen settleOpen;
SpecTransExecutionContext context;
SpecTransManager specTransManager;
CustVendOpenTransManager manager;
CustVendTransData custVendTransData;

if (invoiceTable.SettleVoucher) 
{
     custOpen = null;
     settleOpen = null;

   select firstonly settleTrans
    where settleTrans.AccountNum == _custTrans.AccountNum
   && settleTrans.Voucher == invoiceTable.SettleVoucher
   && settleTrans.AmountMST == -_custTrans.AmountMST;


if (settleTrans)
{
custOpen = CustTransOpen::findRefId(_custTrans.RecId);
settleOpen = CustTransOpen::findRefId(settleTrans.RecId);
custTable = CustTable::find(_custTrans.AccountNum);
manager = CustVendOpenTransManager::construct(custTable);
}


if (custOpen && settleOpen && custOpen.AmountMST == -settleOpen.AmountMST)
{


manager.updateTransMarked(custOpen,NoYes::Yes);
manager.updateTransMarked(settleOpen,NoYes::Yes);
manager.updateSpecTransWithSelectedDate();

manager.settleMarkedTrans();

}

And it works fine, the transactions are getting settled, the only issue appears when we use Settle and post sales tax, in the end.

But when I was debugging our solution and standard also, I couldn't see the difference in call stack.

Any help?

Thanks

I have the same question (1)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Subra Profile Picture

Subra 385

#3
Martin Dráb Profile Picture

Martin Dráb 252 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans