Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Change header status once the line (grid)gets changed

(0) ShareShare
ReportReport
Posted on by 503

Dear All,

Greetings. Hope all are safe

Sorry if this sounds a common sense question but i m stuck

 I have two customized table(header and line table) in AX 2012

A new form is dveloped where the dataource is the header and line table

I have a button on form which will explicit change the status at line level

Say header mainmachine is TEST001, Status-Open

Line(grid level) will be Test001,submachine1,Status-CLosed

                          Test001.submachine2,status-submitted

When the button  on form is clicked, it will make the status of all line as Closed. I want the header status to be closed too as all the lines asscoiated with header are closed.

I tried but the code don't work, Also putting the code in execute query method of line datasource do not work too.

header-line-community-Ax-2012paint.jpg

  • ergun sahin Profile Picture
    8,816 Moderator on at
    RE: Change header status once the line (grid)gets changed

    I wrote it as above but later realized there was a button . In fact, most of them are still valid, but obviously there is a code to update the record. Why couldn't you update it in that code. How did you get an error.

  • Suggested answer
    ergun sahin Profile Picture
    8,816 Moderator on at
    RE: Change header status once the line (grid)gets changed

    If you want it to work only in the form you are on, you can add code to line_ds.update

    if you want this new structure to work in all ax you can add it to table.update.

    If you write to the table, use doUpdate or update_recordSet (with skip data methods) because the update method of the same table will be called (when you update other lines).

    I've seen people writing the update code to validate and validateWrite, but it's open to discussion

    Also, if you do not refresh the data in the form after the update process, you will not be able to see the changes you have made.

    Finally, when you look at the ax standard forms, you cannot see this type of update. There are always exceptions, but for example if you are going to keep the status the same across all relevant records, do you really need line-based status? Or, check if it is possible to move this update process to the table or class.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,760 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans