Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Form datasource cursor resetting to first record on refresh

(0) ShareShare
ReportReport
Posted on by

I have a requirement where I have to display CostCenter from financial dimensions from purchase order header on the grid of "All purchase orders" and it must be filterable.

For this I made a custom view to get CostCenter for each purchase order and added it as a datasource on the form (PurchTable) with Inner Join with table (PurchTable). It worked as expected except one issue that the cursor goes back to the last record on refreshing the form.

The form itself works fine if I remove my custom data source. So, as per my findings View as a datasource is causing the cursor to reset to the last record on refresh but I don't know why its happening and how to fix this. 

Any help is appreciated.

  • m.kamal Profile Picture
    m.kamal on at
    RE: Form datasource cursor resetting to first record on refresh

    Hi, thanks for the links. I found the following solution from there and it works.

    public void executeQuery()
    {
        PurchTable purchTable = this.cursor();
        RecId purchRecId = purchTable.RecId;
    
        next executeQuery();
    
        if (purchRecId)
        {
            purchTable = PurchTable::findRecId(purchRecId);
            this.positionToRecord(purchTable);
        }
    }

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Form datasource cursor resetting to first record on refresh

    Hi, Please check these threads and see if it helps you

    community.dynamics.com/.../if-i-refresh-form-its-move-to-grid-last-records-only

    community.dynamics.com/.../refresh-form-retain-position

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…

Vahid Ghafarpour – Community Spotlight

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

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans