How to get required fields error summary?

Primary tabs

Hi Team,

I am using %JSON.Adaptor class for Json validation.

Using below statement I got only one required field validation.(refer below screen)

    SET stat = objExternalUser.%JSONImport(%request.Content)

I need summary of all required field.






  • 0
  • 0
  • 108
  • 3
  • 1


Hi Vivek!

If you want to check for all the required fields instead of checking it on %Save,  you better scan the class before %Save on the properties with required flag and check whether you have the value for it.

IMHO, this is the only way to show all the required fields at once.


I believe the %JSON import method returns after hitting an error like that, so it's probably more work than you think to have the error give you all fields that are required and empty.

But could you be a little more specific about your use case and exactly what problem you're trying to solve?  There might be a better way.

Hi John,

I want to display error summary like below.

Error Summary:

Please enter First Name.

Please Enter Last Name.

Please Enter DOB.

Oh, okay!  I think the fastest way to get to what you want would be front end form validation.

Whatever you're using to build the UI that leads to this JSON post, have that code mark certain fields as required, and then alert if those aren't filled.  In general, I think in the division of labor that task typically falls to the front end.

In theory, you can write a server method that scans the input before JSON import and then throws a custom exception with all the missing fields, but that's likely more work than doing it on the front end (because the front end will still have to catch that, then assemble the alert message from it anyway).

Also, if you're going to be changing which fields are required a lot, you can (in theory) write a server method which exposes which fields are required, instead of hard-coding that in the front end, but, again, that's likely not worth the effort.

Any of that helpful, or am I misunderstanding the problem?