Question
· Aug 28, 2019

How to get required fields error summary?

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.

Discussion (4)0
Log in or sign up to continue

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?