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 :
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,039 Super User 2025 Season 2 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,428 Super User 2025 Season 2 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

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans