---
title: "Require fields in subtasks"
canonical: "https://support.appfire.com/space/PSJ/15481497/Require%20fields%20in%20subtasks"
format: markdown
---
> Macro (aura-html)

 

Use this script as a workflow transition validator to allow transition only if a field in the subtask is populated.

```
string [] subtasks = subtasks(key);
boolean hasField = false;
string errorMsg = "You must have a value for the Fruit field in a subtask entered before this issue can be completed.";

for(string st in subtasks) {
    if(isNotNull(%st%.fruit)) {
        hasField = true;
    }
}

if(hasField == false) {
   return false, "error", errorMsg;
}
```