Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Answered

multiple error in single message.

Posted on by 42
I have created one action on which I am using multiple testfield. So when I click on action it is checking value one by one.But how I want is that it will check for all fields first then give an error that these fields should be filled in.I tried using error collection but issue is that there is constant message appear that" There are multipe error occur click on..... to see error". So instead of that I want to show error message directly for all blank field .Any idea how can I do this?
Thanks in Advance.
Categories:
  • Verified answer
    Khushbu Rajvi. Profile Picture
    Khushbu Rajvi. 1,769 on at
    multiple error in single message.
    Hi Salba, If you are unable to achieve it using Testfield you can use below logic.
  • Suggested answer
    VK-16090859-0 Profile Picture
    VK-16090859-0 14 on at
    multiple error in single message.
    TESTFIELD raises an error and stops execution at first line, so you'll have to use a combination of manual checks and accumulate the error to achieve this actually something like this:
     
    _ErrorMsg := '';


    if Field1 = '' then
    _ErrorMsg := _ErrorMsg + 'Field 1 cannot be empty.\n';


    if Field2 = 0 then
    _ErrorMsg := _ErrorMsg + 'Field 2 cannt be zero.\n';
     
    And so on.....
    Rgds,
    VKS
  • Suggested answer
    multiple error in single message.
    Check out the "Collectible Errors" Section of this Blog.
     
    The core concept is to collect errors during a run and throwing all errors at once the run is complete.
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    Khushbu Rajvi. 1,769 on at
    multiple error in single message.
    Hi Salba, If you are unable to achieve it using Testfield you can use below logic.
     

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,556 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,625 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans