Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

multiple error in single message.

Posted on by 54
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.
  • Verified answer
    Khushbu Rajvi. Profile Picture
    Khushbu Rajvi. 4,598 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. 4,598 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans