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

how to fill a form the opens when a button is clicked with the values coming from the record in the grid that i'm standing at. AX 2012

(0) ShareShare
ReportReport
Posted on by 1,552

I have a grid that contains 3 fields: x,y and z and are filled according to the selected line in the grid. I also have a button above the grid, when clicked a new form appears that contains the same fields x and y but empty. What i need to do is that when i click the button these two fields needs to be filled with the same data as the grid. This is what i did:

void clicked()

{
Args args;
FormRun formRun;
super();
args = new args();
args.record(projCostTrans);
args.name( formstr( Updatee ) );
formRun = classFactory.formRunClass( Args );
formRun.init();
formrun.run();
formrun.wait();
formRun.detach();
TmpTable_ds.research();
TmpTable_ds.executeQuery();
ProjCostTrans_ds.refresh();
ProjCostTrans_ds.executeQuery();

}

public void init()
{
ProjCostTrans projCostTrans;
super();

projCostTrans=element.args().record();
TmpTable.x=ProjCostTrans.x;
TmpTable.y=ProjCostTrans.y;
TmpTable_ds.research();

TmpTable_ds.executeQuery();
}

when i debug i  can see that the tmp table is filled but the form is still empty, is it something about refresh? plus does my code contain extra things that are not needed?

*This post is locked for comments

I have the same question (0)
  • Ghetz Profile Picture
    3,013 on at

    Not sure you are taking the correct approach, but for starters you could try actually inserting the data. (TmpTable.insert())

    I recommend you check out how standard forms with similar behaviour are programmed and follow the same pattern.

    Also search for posts about using temp tables in forms like this one

    [View:https://community.dynamics.com/ax/b/dynamicsaxinsightbyanas/archive/2014/08/20/ax-2012-using-temporary-table-as-form-s-datasource]

  • Suggested answer
    zeeshan.shaikh Profile Picture
    683 on at

    Hi,

    Please make sure you have filled the grid data source property with the TmpTable DS on your Updatee.

    You can also set your fields in InitValue method under form data source methods.

    Also, i would recommend to follow best practices while doing this task.

    Regards,

    Ali Zeeshan

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

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans