web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

refresh form after formdatasource validate write

(1) ShareShare
ReportReport
Posted on by 1,836
 i have written the validate write method on form datasource the method is working fine but i need to refresh the form manually because when the error gets triggered the lines get dissaperar and after refresh the lines appear i cannot hit the refresh button all the time need to refresh form after validation . please suggest me how can i get it done .
below is my code
 
I have the same question (0)
  • Dineshkarlekar Profile Picture
    1,836 on at
         public boolean validateWrite()
            {
                boolean ret;
                DTDMCHeaderLines    dTDMCHeaderLinesInv = this.cursor();
                
                select firstonly DTDMCHeaderLines
                    where DTDMCHeaderLines.InvoiceId == dTDMCHeaderLinesInv.InvoiceId;
                if(DTDMCHeaderLines.RecId != 0)
                {
                    throw error('InvoiceId Already Exist');
                }
                ret = super();
    
                return ret;
            }
     
  • Suggested answer
    Waed Ayyad Profile Picture
    9,081 Super User 2026 Season 1 on at
    Hi,
     
    You can try to add the following code:
     
    YourDatasourceName_ds.reread();
    YourDatasourceName_ds.rereadreferenceeDatasource();
    YourDatasourceName_ds.research(true).
    
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    You can achieve this by calling the research(true) for the header/first/main datasource.
     
    But I couldn't understand your code. The buffer which you are selecting, I don't find it anywhere in the code where you defined it. Also you are getting the invoice lines from cursor(). Then it is not required to use the select statement again to find the lines.
     
    Also I would suggest to understand why lines are getting disappeared instead of making it refresh from code.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,801 Super User 2026 Season 1 on at
    Hi,
     
    try this :
    public boolean validateWrite()
    {
        boolean ret;
    
        ret = super();
    
        // your validation 
        if()
        {
            ret = ...
        }
    
        if(!ret)
        {
            {{YourTable}}_ds.reread();
            {{YourTable}}_ds.refresh();
            {{YourTable}}_ds.research().
        }
    
        return ret;
    }
    Best regards,
    Mohamed Amine MAHMOUDI

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 493

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 413 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 242 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans