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 :
Microsoft Dynamics AX (Archived)

Remove validation on table method using extensions

(0) ShareShare
ReportReport
Posted on by 70

In system method validateField there is a validation that I want to remove. 
Any suggestions?

*This post is locked for comments

I have the same question (0)
  • Marija Todorovic Profile Picture
    70 on at
    RE: Remove validation on table method using extensions

    I managed to achieve this with overriding validation on the form control.

    [FormDataSourceEventHandler(formDataSourceStr(ProjTable, ProjTable), FormDataSourceEventType::Initialized)]

       public static void ProjTable_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)

       {

           sender.object(fieldNum(ProjTable,WorkerResponsibleFinancial)).registerOverrideMethod(methodStr(FormDataObject, validate),methodStr(ProjTable_AdSv_Extension,validateWorkerResponsibleFinancial));    

       }

       public boolean validateWorkerResponsibleFinancial(FormDataObject _targetField)

       {

           return true;

       }

  • Mea_ Profile Picture
    60,284 on at
    RE: Remove validation on table method using extensions

    It would be helpful if you provide more details, like error message or code you are trying to use.

  • Marija Todorovic Profile Picture
    70 on at
    RE: Remove validation on table method using extensions

    When I call cancel it throws an error.

  • Douglas Noel Profile Picture
    3,905 on at
    RE: Remove validation on table method using extensions

    Hi

    Take a look at

    community.dynamics.com/.../customizing-d365-with-event-handlers

    EventHandler onValidatingField set parmResult to true in that case

    You have the fieldname in the eventargs too.

    Maybe you can try to set true in that case?

    Sorry can't check.

    regards Douglas

  • Mea_ Profile Picture
    60,284 on at
    RE: Remove validation on table method using extensions

    Did you try to call "cancel" ?

  • Marija Todorovic Profile Picture
    70 on at
    RE: Remove validation on table method using extensions

    Thank you for the reply, but I cannot see how to skip validation using FormDataFieldCancelEventArgs.

    As per my understanding with this class I could just stop the execution - throw an error.

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at
    RE: Remove validation on table method using extensions

    Hi Marija Todorovic,

    You can subscribe to Validating event on form data source field and cancel super(). To find example just do cross references for FormDataFieldCancelEventArgs class in AOT and see it's usage.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#1
Guy Terry Profile Picture

Guy Terry 2 Moderator

#1
Rahul Shah Profile Picture

Rahul Shah 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans