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 :
Finance | Project Operations, Human Resources, ...
Unanswered

How to mark Vendor open settlement transaction using x++ in D365fo

(3) ShareShare
ReportReport
Posted on by 46
By clicking on 'Settle transactions,' the system will automatically display only the invoices linked to my specific table that have a relationship with the selected LedgerJournalTrans and mark them for settlement
I tried the code, but it doesn't work

[ExtensionOf(formStr(VendOpenTrans))]

final class GTCVendOpenTrans_Form_Extension

{

    public void init()

    {

        VendTrans VendTrans;

        VendTransOpen vendTransOpen;

        GTCLCInvoiceLink LCInvoiceLink;

        LedgerJournalTrans ledgerJournalTrans;

        SpecTransManager specTransManager;

        SpecTransExecutionContext specTransExecutionContext;

        CustTransSettleTransactionParameters settleParams;

 

        next init();

        FormDataSource formeDataSource = this.VendTransOpen_ds;

 

        if (originator.TableId == tableNum(LedgerJournalTrans))

        {

            ledgerJournalTrans = originator;

        }

 

        if (ledgerJournalTrans)

        {

            QueryBuildDataSource vendTransQbds = VendTrans_ds.query().dataSourceTable(tableNum(VendTrans));

            List invoiceList = new List(Types::String);


            if (vendTransQbds)

            {

                while select GTCInvoice from LCInvoiceLink

                    where ledgerJournalTrans.GTCLCCode == LCInvoiceLink.GTCLCCode

                {


                    QueryBuildRange invoiceRange = vendTransQbds.addRange(fieldNum(VendTrans, Invoice));

                    invoiceRange.value(LCInvoiceLink.GTCInvoice);
                  
ttsbegin;
                // If transactions were marked, write back to originating record if needed
               manager.updateOriginatorForMarkedTrans();

               // update all SpecTrans records with date used to calculate discount
               manager.updateSpecTransWithSelectedDate();
              ttscommit;
}}}

Categories:
I have the same question (0)
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    Hi,

    When you say it doesn't work, can you please explain what is not working.
    Looking at your screenshot, one line is marked and the other one is not, is this what is not working? that u want both to be ticked? or is it that the invoices that you want are not appearing.

    please explain further?
  • MariamW Profile Picture
    46 on at

    Hi @Layan Jwei ,

    Yes, I want to mark all the lines in the grid after applying the filter. As mentioned in the screenshot, two lines appear after applying the filter, but only the first one is marked. I need all the lines displayed after my filter (applied via X++ code) to be marked.

    Let me know if you need more 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

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans