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 can I refresh salestable form but stay on the same record

(0) ShareShare
ReportReport
Posted on by 20

When you refresh the SalesTable form with F5, the form stays on the same sales order but jumps to the first salesline on that order.

 

So if you have 100 sales lines and press F5 then you lose your current position in the lines part of the screen.

 

I have tried overwriting the Task method of the form adding a salesline_ds.findrecord(tmpsalesline); instruction. The findrecord is carried out but then it jumps to the first record.

I also tried adding a method on a button that reads

Salesline tmpsalesline;

tmpsalesline.data(salesline);

salestable_ds.research(true);

salesline_ds.findrecord(tmpsalesline);

This behaves in exactly the same way, the correct record is selected but then the screen jumps to the first record.

Does anyone have any idea what is going on?

*This post is locked for comments

I have the same question (0)
  • Peter Niessen Profile Picture
    160 on at

    use

    tmpSalesLine = salesLine.data();

    SalesLine_ds.executeQuery();

    salesLine_ds.findRecord(tmpSalesLine);

    salesLine_ds.setCurrent();

    regards,

    Peter

  • Community Member Profile Picture
    on at

    Hi Everyone,

    i have used the same logic for custtable form, my issue is solved . but when i use tgis code, my edit button is disabled.

    here is my code:

    public int task(int _taskId)

    {

       CustTable   custTable_TmpTable;

       int ret;

       //ret = super(_taskId);

       custTable_TmpTable = Custtable.data();

       Custtable_DS.executeQuery();

       Custtable_DS.findRecord(custTable_TmpTable);

       Custtable_DS.setCurrent();

       return ret;

    }

    i have commented Ret =  super(_taskid), because, it is causing the same issue...i.e., going back to different values.

    so, i commenetd it.

    please guide me.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    It is because you are doing it wrong. If you comment out the super call to task(), that will break your whole form since it will not receive and execute input commands from the keyboard and mouse. Also if you do _any_ action then you execute a research, which is a horrible idea. You want to only execute it in case of a record refresh, take a look at the Tasks macro in the AOT to hook it up only for that specific TaskId.

    In my opinion it is better to store the previous record selection on the formdatasource.active() method, and set the cursor position in the executQuery() to the previously stored entry in case of the parent datasource is the same.

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