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 :
Microsoft Dynamics AX (Archived)

Table Data does not refresh after Customized Button click

(0) ShareShare
ReportReport
Posted on by 209

hello everyone, i need help here

I have made a button in Inventory Management > Periodic > Transfer Orders > Lines

which deletes the Inventory Transactions which is not Reserve Physical (when partial) here is the picture:

8360.x.png

I have this code to delete the Not Reserved Physical (on order):

void clicked()
{
InventTransOrigin inventTransOrigin;
InventTrans inventTrans;

ttsBegin;
{
select forUpdate inventTrans
join inventTransOrigin
where inventTrans.InventTransOrigin == inventTransOrigin.RecId
join InventTransferLine
where inventTransOrigin.InventTransId == InventTransferLine.InventTransId
&& inventTrans.StatusIssue != 4
&& InventTransferLine.TransferId == InventTransferTable.TransferId;
inventTrans.delete();
}
ttsCommit;

super();
InventTransferLine_ds.refresh();
InventTransferLine_ds.executeQuery();
}

--------

when i run this, the table becomes blank, it looks like this:

y.png

so I close and open it again, and the Table Data shows up,  and the On Order is now removed ( meaning the Delete Code Works, but the Data does not Refresh in the Table)

Now, what I need is to Refresh the Table Data of the Form after the Deleting, (the Datasource is InventTransferLine_ds)

Please help me, thanks.

*This post is locked for comments

I have the same question (0)
  • Hariharans87 Profile Picture
    34 on at

    Please call the refresh after the execute query.

    InventTransferLine_ds.executeQuery();

    InventTransferLine_ds.refresh();

  • Verified answer
    5400 Profile Picture
    7,162 on at
    Why forupdate is required.
    why are selecting InventTransferLine, it is in your scope.

    Please try with below code and check.
    void clicked() { InventTransOrigin inventTransOrigin; InventTrans inventTrans; ttsBegin; { select inventTrans join inventTransOrigin where inventTrans.InventTransOrigin == inventTransOrigin.RecId //join InventTransferLine && inventTransOrigin.InventTransId == InventTransferLine.InventTransId && inventTrans.StatusIssue != 4 && InventTransferLine.TransferId == InventTransferTable.TransferId;
    if ( inventTrans)
    { inventTrans.delete();
    } } ttsCommit; super(); InventTransferLine_ds.refresh();
    }

    Only you want to delete inventtrans, why not InventTransferLine. is there any specific reason .
  • XSpy Profile Picture
    209 on at

    hi Hariharan,

    i tried using your suggestion, but nothing happened,

    all lines are gone, but after closing and opening it again, it will be back up again.

    and the Delete Inventory is still working.

    I just can't seem to refresh the data.

  • XSpy Profile Picture
    209 on at

    Hi Bhaskar Roy!

    forupdate is important because im getting error when i didnt put it,

    so I used your code and put forupdate in there:

    void clicked()

    {

    InventTransOrigin inventTransOrigin;

    InventTrans inventTrans;

    ttsBegin;

    {

    select forupdate inventTrans

    join inventTransOrigin

    where inventTrans.InventTransOrigin == inventTransOrigin.RecId

    //join InventTransferLine

    && inventTransOrigin.InventTransId == InventTransferLine.InventTransId

    && inventTrans.StatusIssue != 4

    && InventTransferLine.TransferId == InventTransferTable.TransferId;

    if ( inventTrans)

    {

    inventTrans.delete();

    }

    }

    ttsCommit;

    super();

    InventTransferLine_ds.refresh();

    }

    and now its working! thanks!

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans