Class CreationWorkflowDefinition

Object
CreationWorkflowDefinition

public class CreationWorkflowDefinition extends Object
Defines a document Creation Workflow: the ordered list of steps in which users cooperate on creating a Quote, Agreement/Promotion, Rebate Agreement, or Compensation Plan before it is submitted for approval.

You get an instance from api.newCreationWorkflow() in a logic whose nature is Creation Workflow, add steps created by api.newCreationWorkflowStep(), and return it as the element result. The result of the first element that returns a CreationWorkflowDefinition is used as the definition of the Creation Workflow. If the returned definition has no steps, the Creation Workflow finishes immediately.

The logic runs again each time the workflow starts, each time a user moves the document to the next or previous step, and optionally when the document is saved, so you build the steps in every execution.

Example:


 def step1 = api.newCreationWorkflowStep()
         .withLabel("Add Products")
         .withUserAssignee("Bill.Greene")

 def step2 = api.newCreationWorkflowStep()
         .withLabel("Input params")
         .withUserGroupAssignee("SalesEMEA")

 return api.newCreationWorkflow()
         .withSteps(step1, step2)
 
See Also:
  • Constructor Details

    • CreationWorkflowDefinition

      public CreationWorkflowDefinition()
  • Method Details

    • getSteps

      Retrieves a list of all steps in the given workflow.

      The steps are returned in the order in which they were added by withSteps(CreationWorkflowStepDefinition...). The position of a step in the list is its step index (starting at 0), which is the value used by resetCurrentStepTo(int). The method never returns null; the list is empty when no steps were added. The returned list is the workflow's own list, not a copy, so changes to it change the workflow definition.

      Example:

      
       def cwf = api.newCreationWorkflow()
               .withSteps(step1, step2)
      
       def stepCount = cwf.getSteps().size()  // 2
       
      Returns:
      a list of CreationWorkflowStepDefinition objects.
      Since:
      3.4.0 - Cuba Libre
      See Also:
    • withSteps

      Adds specified steps (must be already defined within the logic) to the Creation Workflow.

      The steps are appended in the given order after any steps added earlier, so calling this method repeatedly adds more steps. The order determines the sequence in which the document moves through the workflow.

      Example:

      
       return api.newCreationWorkflow()
               .withSteps(step1, step2, step3)
       
      Parameters:
      steps - The list of steps (CreationWorkflowStepDefinition).
      Returns:
      The CreationWorkflowDefinition object with given steps.
      Since:
      3.4.0 - Cuba Libre
      See Also:
    • resetCurrentStepTo

      public void resetCurrentStepTo(int step)
      Switches the Creation Workflow to the specified step, ignores what the user clicked in the user interface.

      The step index starts at 0 and refers to the position of the step in getSteps(). The switch is applied after the logic finishes:

      • If step is lower than the number of steps, the Creation Workflow is set to In Progress and moves to that step.
      • If step is equal to or greater than the number of steps, the Creation Workflow is set to Finished.
      Note: Call this method only on a definition that has at least one step, and use a non-negative value. A negative value, or a definition without steps, makes the Creation Workflow execution fail.

      Example:

      
       def creationWF = api.newCreationWorkflow()
               .withSteps(costsStep, pricingStep)
      
       creationWF.resetCurrentStepTo(1)  // move to "pricingStep"
       return creationWF
       
      Parameters:
      step - The number of a step you want to switch the Creation Workflow to.
      Since:
      3.4.5 - Cuba Libre PR5
      See Also:
    • getRequestedCurrentStep

      public Integer getRequestedCurrentStep()