Portal Community

Two Layers of Validation

LayerWhereWhat Validates
Client-sideAtlas Forms player (browser)Required fields, field format, min/max, regex patterns
Server-sideResume API endpointBusiness rules, cross-field logic, authorization checks

Server-Side Validation Config

{
  "serverValidation": {
    "rules": [
      {
        "field": "approvedAmount",
        "rule": "$value <= $output.parseClaim.amount",
        "message": "Approved amount cannot exceed the claimed amount"
      },
      {
        "field": "approvedAmount",
        "rule": "$value > 0",
        "message": "Approved amount must be positive"
      },
      {
        "field": "approvalDecision",
        "rule": "$value === 'rejected' ? $fields.rejectionReason !== '' : true",
        "message": "Rejection reason is required when rejecting"
      }
    ]
  }
}

Validation Failure Response

If server-side validation fails, the resume API returns 422 with field-level errors. The FormRenderer stays open and displays the errors inline:

HTTP 422 Unprocessable Entity
{
  "validationErrors": [
    {
      "field": "approvedAmount",
      "message": "Approved amount cannot exceed the claimed amount"
    }
  ]
}

The user corrects the errors and resubmits. The workflow remains suspended during validation failures.

Authorization Validation

The resume endpoint also validates that the actor submitting the form is the authorized actor for this task. Unauthorized submit attempts return 403 and do not resume the workflow:

// Resume API authorization check
if (!task.IsAssignedTo(actorId))
    return Forbid("You are not authorized to complete this task");

if (task.Status != HILTaskStatus.Pending)
    return Conflict("This task has already been completed or cancelled");