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

In Form OnValidateWrite validation.

(0) ShareShare
ReportReport
Posted on by 130

Hi guys,

i want to in FormDataSource onvalidateWrite how to do in set return value of the boolean (setReturnvalue(true) and as i know 

table onvalidateWrite how to do the process, then i don't want to cancel any thing FormdatsourceCancelEventArgs.

[FormDataSourceEventHandler(formDataSourceStr(PurchTable,PurchLine), FormDataSourceEventType::ValidatingWrite)]
public static void PurchLine_OnValidatingWrite(FormDataSource sender, FormDataSourceEventArgs e)
{
   var datasource = sender as FormDataSource;

   var record = datasource = sender as formdataSource;
   boolean ret = true;

  if(record.NetAmount 

Thanks.

  

  


I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    Hi WayToAX,

    In this way, you can use the FormDataSourceEventArgs variable 'e'.

    like: e.setReturnValue(false);

  • WaytoAx Profile Picture
    130 on at

    Thanks For your replay André Arnaud de Calavon ,

    FormDataSourceEventArgs fse = e; i already tried but not show setReturnValue(false);

  • André Arnaud de Calavon Profile Picture
    301,130 Super User 2025 Season 2 on at

    You are correct. My bad.... I reviewed a case where XppPrePostArgs was used.

    What is the reason to do coding on the form datasource instead of the table?

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    You could also use Chain of Command on this method, which allows you to set the return value easily.

  • WaytoAx Profile Picture
    130 on at

    i already tried many time in Table Events onvalidatewrite same process i want to do the FormDS ValidateWrite without  FormdatsourceCancelEventArgs so that what to be done ?

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    Why do you want to do it without FormDataSourceCancelEventArgs? Where does such requirement come from?

    I assume that you have a functional requirement to run some validation logic and prevent the user from saving a record with invalid data.

    Does your requirement also say that this validation must be added only on this form, but users of other forms, Excel add in and other data input methods should be allowed to enter "invalid" data (without this custom validation)?

    Could you share your exact functional requirement, this way we can provide you best possible help. Thanks!

  • WaytoAx Profile Picture
    130 on at

    Thanks for your replay Nikolaos Mäenpää,

    in PurchTable FormDS method Don't  ValidateWrite. but i am able use COC table ValidateWrite method.

    my question in FormDS onvalidateWrite how to set return value  setReturnValue(false) it is possible?

  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    I'm not actually sure how to do it with event handler.

    But here's how to do it with Chain of Command (this example will prevent users from saving any new purchase lines on PurchTable form):

    [ExtensionOf(formDataSourceStr(PurchTable, PurchLine))]
    final class MyGreat_Extension
    {
        public boolean validateWrite()
        {
            boolean ret = next validateWrite();
            Info("We are in validateWrite CoC method");
            return false;
        }
    
    }

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 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans