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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Partial unsettlement through X++?

(0) ShareShare
ReportReport
Posted on by 136

Hi all

Does anybody know any way to partially unsettle two customer transactions through x ?

I can reverse the entire settlement using...

public static void unsettleCustomerTransaction(CustTrans _custTrans)
{
    CustTable custTable = CustTable::find(_custTrans.AccountNum);
    SpecTransManager specTransManager = SpecTransManager::newRefTableId(custTable, tableNum(CustSettlement), true);

    CustSettlement custSettlement;

    while select custSettlement
        where custsettlement.TransRecId == _custTrans.RecId &&
        custSettlement.TransCompany == _custTrans.DataAreaId &&
        custSettlement.CanBeReversed
    {
        if (!specTransManager.existForOtherSpec(custSettlement.DataAreaId, custSettlement.TableId, custSettlement.RecId))
        {
            custSettlement.CustVendSettlement::markThisAndRelatedOffsets(specTransManager, _custTrans.CurrencyCode);
            CustTrans::reverseTransact(custTable, null, SettleDatePrinc::DaysDate, dateNull(), true);
            
            specTransManager.deleteAll();
        }
    }
}

and I can settle transactions with a chosen amount using the SpecTransManager and insert which allows setting of the settlement amount.

specTransManager.insert(custTransOpenToSettle.company(), custTransOpenToSettle.TableId, custTransOpenToSettle.RecId, _settleAmount1 ? _settleAmount1 : custTransOpenToSettle.AmountCur, _custTrans1.CurrencyCode);

But I can't use the same process for unsettling them. Firstly in most cases there is no open transaction, but even if there is, simply trying to change the sign and use the standard functionality doesn't work.

I have seen that the unsettle process from the customer transaction screen doesn't allow specific amounts to be specified, so I guess it's impossible, but if anybody has any other ideas I would love to hear them.

Thanks

Andrew

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    299,397 Super User 2025 Season 2 on at
    RE: Partial unsettlement through X++?

    Hi Andrew,

    There is no support out of the box for partly unsettle transactions. You can fully unsettle and partly settle again to get the required outcome.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,028

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 878 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 579 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans