A recipe step that creates a Task for the account admin to complete, optionally offering a choice of outcomes that each lead to a different next step. Configured in an app's recipe XML as a "recipe-task" element with a title, description and icon shown to the admin, and optionally a list of settings or prior tasks required before the task is created. When RecipeManager enters this step it creates the task; when the admin completes it, RecipeManager.completeTaskWithOutcome runs the selected outcome's process function and transitions to that outcome's configured next step.

Group: Recipes

Extends: AbstractRecipeStep


Properties

PropertyReturnsDescription
allNextStepsList<RecipeStep>The distinct next steps that this task's outcomes can lead to.
descriptionStringSummary of this step, combining the configured task description with the title of each outcome and, for outcomes with no next step, a note that they end the recipe.
faIconStringFont Awesome icon identifier shown alongside this task.
outcomesList<TaskRecipeStepOutcome>The possible outcomes an admin can select when completing this task, each leading to a different next step.
titleStringDisplay title for the task this step creates.

Methods

getTitle() · getDescription() · getFaIcon() · getOutcomes() · outcome(String id) · copy() · withOutcome(String id, String title, String formPath, String processFn, String canCompleteFn, String isAvailFn, RecipeStep nextStep, String defaultFormValue) · withOutcome(String id, String title, String formPath, String processFn, String canCompleteFn, RecipeStep nextStep, String relatedHref, String isAvailFn, String defaultFormValue) · withIcon(String icon) · withTitle(String title) · withDescription(String desc) · withRequiredSettings(String settings) · withRequiredTasks(String taskNames) · relatedHref(TaskRecipeStepOutcome outcome, Project p) · isOutcomeAvailable(TaskRecipeStepOutcome outcome, Project p) · completeWithOutcome(TaskRecipeStepOutcome outcome, RecipeContext rc, FormContext form) · getAllNextSteps()

getTitle()

Returns: String

Display title for the task this step creates.

getDescription()

Returns: String

Summary of this step, combining the configured task description with the title of each outcome and, for outcomes with no next step, a note that they end the recipe.

getFaIcon()

Returns: String

Font Awesome icon identifier shown alongside this task.

getOutcomes()

Returns: List<TaskRecipeStepOutcome>

The possible outcomes an admin can select when completing this task, each leading to a different next step.

outcome(String id)

Returns: TaskRecipeStepOutcome

Looks up one of this task's configured outcomes by its id.

ParameterDescription
idthe id of the outcome to find

copy()

Returns: RecipeStep

Creates an independent copy of this step, including a copy of its outcome list.

withOutcome(String id, String title, String formPath, String processFn, String canCompleteFn, String isAvailFn, RecipeStep nextStep, String defaultFormValue)

Returns: TaskRecipeStep

Returns a copy of this step with an additional outcome appended, with no related href.

ParameterDescription
idunique id for the outcome within this step
titledisplay title for the outcome
formPathpath to the form shown when the admin selects this outcome, may be null
processFnthe JS function to run when this outcome is selected, returning a JsonResult
canCompleteFnJS function that checks whether this outcome can currently be completed, may be null
isAvailFnJS function that checks whether this outcome is currently available, may be null
nextStepthe step to enter after this outcome is processed
defaultFormValuedefault value to pre-fill the outcome's form with, may be null

withOutcome(String id, String title, String formPath, String processFn, String canCompleteFn, RecipeStep nextStep, String relatedHref, String isAvailFn, String defaultFormValue)

Returns: TaskRecipeStep

Returns a copy of this step with an additional outcome appended.

ParameterDescription
idunique id for the outcome within this step
titledisplay title for the outcome
formPathpath to the form shown when the admin selects this outcome, may be null
processFnthe JS function to run when this outcome is selected, returning a JsonResult
canCompleteFnJS function that checks whether this outcome can currently be completed, may be null
nextStepthe step to enter after this outcome is processed
relatedHrefa related link for the outcome, may reference a "function:" JS callback, may be null
isAvailFnJS function that checks whether this outcome is currently available, may be null
defaultFormValuedefault value to pre-fill the outcome's form with, may be null

withIcon(String icon)

Returns: TaskRecipeStep

Returns a copy of this step with the given Font Awesome icon.

ParameterDescription
iconthe icon id to set on the copy

withTitle(String title)

Returns: TaskRecipeStep

Returns a copy of this step with the given task title.

ParameterDescription
titlethe task title to set on the copy

withDescription(String desc)

Returns: TaskRecipeStep

Returns a copy of this step with the given task description.

ParameterDescription
descthe task description to set on the copy

withRequiredSettings(String settings)

Returns: TaskRecipeStep

Returns a copy of this step that requires the given project settings to be present before its task is created.

ParameterDescription
settingsa comma-separated list of project setting names that must all have values

withRequiredTasks(String taskNames)

Returns: TaskRecipeStep

Returns a copy of this step that requires the given tasks to be completed before its task is created.

ParameterDescription
taskNamesa comma-separated list of task names that must all be completed

relatedHref(TaskRecipeStepOutcome outcome, Project p)

Returns: String

Resolves the related link for the given outcome against the given project: either by running its "function:" JS callback, or by substituting the project's parameters into placeholders in the configured href.

ParameterDescription
outcomethe outcome whose related href is being resolved
pthe project supplying parameter values for placeholder substitution

isOutcomeAvailable(TaskRecipeStepOutcome outcome, Project p)

Returns: boolean

Checks whether the given outcome should currently be offered to the admin, by running its configured availability JS function against the given project.

ParameterDescription
outcomethe outcome to check, may be null
pthe project the availability function is evaluated against

completeWithOutcome(TaskRecipeStepOutcome outcome, RecipeContext rc, FormContext form)

Returns: JsonResult

Runs the given outcome's configured process function, either on another app (if processFn is prefixed with an app id and colon) or via the current app's controller mappings.

ParameterDescription
outcomethe outcome whose process function is being run
rcthe recipe context for the project the task belongs to
formthe submitted form data passed through to the process function

getAllNextSteps()

Returns: List<RecipeStep>

The distinct next steps that this task's outcomes can lead to.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.