Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

table CustTable update() and additional actions

(0) ShareShare
ReportReport
Posted on by 65

Hi,


While updating some custome field (MyField - a ref AccountNum) in CustTable I need change values in other records same table and same field. It's a correct way - I mean especially declaration variable custTable inside method and using update_recordset?



void update(boolean _updateSmmBusRelTable = true, boolean _updateParty = true)
{
CustTable   this_Orig = this.orig();
CustTable       custTable;
(...)
if (this.MyField != this_Orig.MyField)
{
update_recordSet custTable setting
            MyField = this.MyField
            where custTable.MyField == this.AccountNum
                && custTable.AccountNum != this.AccountNum;
}
}

*This post is locked for comments

  • everand Profile Picture
    everand 65 on at
    RE: table CustTable update() and additional actions

    Even if I need updating other records (not this one, with is currently updated)?

    BTW

    I created a separate method to achieve my purpose (to use the code in a job also) using doUpdate().

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: table CustTable update() and additional actions

    if you want to update the same table fields during update, you can just assign your new value to respected field before super().

    Ex:

    this.MyField = "MyValue";

    Super();

    This will take care of the update. No need to call the update method twice.

  • everand Profile Picture
    everand 65 on at
    RE: table CustTable update() and additional actions

    Yes, it works but I wonder if it's in harmony with let's say best practices

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: table CustTable update() and additional actions

    Did you try it? Did it work?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans