Special functions

The definition provides some special purpose functions to provide information about the configured workflow.

These are intended to remove the necessity to make available too much information about the specifics of the workflow, to encourage well-designed composable features.


function getUsedActionableBy()

Returns a de-duplicated list of all the actionableBy properties in the state definitions.

Note that this will only return information about the currently defined states. If a feature relies on this, it will get different results depending on when in the definition process it’s called.

Workflow feature

function P.workflow.registerOnLoadCallback(callback)

Registers a callback function which will be called when the platform calls the std_workflow onLoad() function, passing in an AllWorkflows object.

P.workflow.registerOnLoadCallback(function(workflows) {
    workflows.forEach(function(workflow) {

function P.workflow.standaloneEntities(entityDefinitions, callback)

Returns an entity system without the context of a workflow. The entity system is an object with a constructEntitiesObject() function which takes a WorkUnit, Ref, or StoreObject returning an object which allows you to access the entities (see Entities).

Pass a dictionary of entity names to definitions (see Entities) and an optional function that is called with the entities object prototype for you to extend. Example:

var standaloneEntities = P.workflow.standaloneEntities({
    "project": ["object", A.Project],
    "supervisor": ["project", A.Supervisor]
var entities = standaloneEntities.constructEntitiesObject(projectPlan);
var supervisor = entities.supervisor_maybe;
if(supervisor) {
    // ...