diff --git a/ui/src/views/Tasks/submitTaskAction.js b/ui/src/views/Tasks/submitTaskAction.js index 05f01e885cd..496fc71d1a4 100644 --- a/ui/src/views/Tasks/submitTaskAction.js +++ b/ui/src/views/Tasks/submitTaskAction.js @@ -13,7 +13,18 @@ import ajv from '../../utils/ajv'; export default async ({ task, form, action, apolloClient, taskActions }) => { const actions = removeKeys(cloneDeep(taskActions), ['__typename']); - const taskGroup = task.taskId === task.taskGroupId ? task : task.decisionTask; + // We need to source scopes from somewhere. Typically these come from the task we're given, + // which is either a regular decision task or an action task. Decision tasks are easily + // identified, because their taskId matches the taskGroupId that they are in. Action tasks + // do not have such a mapping. Instead, we're simply going to try our best by falling back + // to `task` if `task.decisionTask` is null or undefined. + // At the time of writing, it's not clear whether the `task.decisionTask` case is even valid + // anymore, but it's being kept for the time being because verifying that is not a trivial + // matter. + const taskGroup = + task.taskId === task.taskGroupId || !task.decisionTask + ? task + : task.decisionTask; const input = load(form); const validate = ajv.compile(action.schema || {}); const valid = validate(input);