Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This error occurs if the null check condition is not added for the fields or custom forms (that are non-mandatory) that are used in any of the edit check rules present in the workflow. Hence, before accessing such fields/forms, we must put a ‘not null’ check.
This check is defined in the ‘when’ part of the edit check syntax.


Here is an example:
Checking the combination of ‘Primary Site’ values from the ‘Demo Pathology’ form concerning participant gender.
We need to check that the form is filled , and the value for ‘Primary Site’ in the form value exists by adding the ‘not null’ condition in the ‘when’ part of the edit check.
"when" : "#cpr.participant.gender == 'Female' && #cpr.registrationDate != null && #visit.visitDate != null && #visitForms['demoPathologyForm'] != null && #visitForms['demoPathologyForm']['primarySite'] != null"

Code Block
languagejsjson
{
        "records" : [ "cpr", "visit" ],
        "forms" : 
        {
          "visit" : [ "demoPathologyForm" ]
        },
        "rules" : 
        [
          {
            "when" : "#cpr.participant.gender == 'Female' && #cpr.registrationDate != null && #visit.visitDate != null && #visitForms['demoPathologyForm'] != null && #visitForms['demoPathologyForm']['primarySite'] != null",
            "expr" : "!{'Penis, NOS', 'Prostate gland', 'Testis, NOS', 'Scrotum, NOS', 'Male genital organs, NOS'}.contains(#visitForms['demoPathologyForm']['primarySite'])",
            "description" : "Check the Primary Site values with respect to gender"
          }
        ]
    }

...