web
You’re offline. This is a read only version of the page.
close
Skip to main content
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,817
 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)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,304 Super User 2025 Season 2 on at
    refresh form after formdatasource validate write
    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
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    refresh form after formdatasource validate write
    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
    Waed Ayyad Profile Picture
    8,893 Super User 2025 Season 2 on at
    refresh form after formdatasource validate write
    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
     
  • Dineshkarlekar Profile Picture
    1,817 on at
    refresh form after formdatasource validate write
         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;
            }
     

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 868 User Group Leader

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 836 Super User 2025 Season 2

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 661

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans