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
| Property | Returns | Description |
|---|---|---|
| allNextSteps | List<RecipeStep> | The distinct next steps that this task's outcomes can lead to. |
| description | 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. |
| faIcon | String | Font Awesome icon identifier shown alongside this task. |
| outcomes | List<TaskRecipeStepOutcome> | The possible outcomes an admin can select when completing this task, each leading to a different next step. |
| title | String | Display 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.
| Parameter | Description |
|---|---|
id | the 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.
| Parameter | Description |
|---|---|
id | unique id for the outcome within this step |
title | display title for the outcome |
formPath | path to the form shown when the admin selects this outcome, may be null |
processFn | the JS function to run when this outcome is selected, returning a JsonResult |
canCompleteFn | JS function that checks whether this outcome can currently be completed, may be null |
isAvailFn | JS function that checks whether this outcome is currently available, may be null |
nextStep | the step to enter after this outcome is processed |
defaultFormValue | default 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.
| Parameter | Description |
|---|---|
id | unique id for the outcome within this step |
title | display title for the outcome |
formPath | path to the form shown when the admin selects this outcome, may be null |
processFn | the JS function to run when this outcome is selected, returning a JsonResult |
canCompleteFn | JS function that checks whether this outcome can currently be completed, may be null |
nextStep | the step to enter after this outcome is processed |
relatedHref | a related link for the outcome, may reference a "function:" JS callback, may be null |
isAvailFn | JS function that checks whether this outcome is currently available, may be null |
defaultFormValue | default 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.
| Parameter | Description |
|---|---|
icon | the icon id to set on the copy |
withTitle(String title)
Returns: TaskRecipeStep
Returns a copy of this step with the given task title.
| Parameter | Description |
|---|---|
title | the task title to set on the copy |
withDescription(String desc)
Returns: TaskRecipeStep
Returns a copy of this step with the given task description.
| Parameter | Description |
|---|---|
desc | the 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.
| Parameter | Description |
|---|---|
settings | a 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.
| Parameter | Description |
|---|---|
taskNames | a 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.
| Parameter | Description |
|---|---|
outcome | the outcome whose related href is being resolved |
p | the 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.
| Parameter | Description |
|---|---|
outcome | the outcome to check, may be null |
p | the 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.
| Parameter | Description |
|---|---|
outcome | the outcome whose process function is being run |
rc | the recipe context for the project the task belongs to |
form | the 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.