Creation Workflow Logic

You will use a Creation Workflow logic when you need to:

  • Allow more users to cooperate on document creation in certain pre-defined order.

  • Build steps for creation workflow for:

    • Agreements & Promotions (Contracts)

    • Compensation Plans

    • Quotes

    • Rebate Agreements

Logic API

  • Logic Nature: creationWorkflow

    • Logic Type: Calculation/Pricing

  • Execution Types:

    1. Standard - When the user clicks on Start CW.

      • To validate - e.g., to check if some input field was not filled by the user.

      • To build the creation workflow steps.

    2. Standard - When the user forwards the document to other users using Back or Next Step buttons.

      • To check if the user, who submits the step, is authorized to do it.

      • To build the creation workflow steps. Note that you build the steps in every execution of the creation workflow.

    3. Standard - When the document is saved. This depends on the setting of Run document creation workflow logic on save.

  • Information provided to the logic:

    • api.currentItem() - Object for which we build the creation workflow. Fields useful for handling the creation workflow:

      • creationWorkflowStatus, creationWorkflowCurrentStep, creationWorkflowStepLabel - Provide you with information about the current state of the creation workflow.

      • typedId - Is empty until the document is first saved.

    • Allow object modification - The logic can write data to tables.

    • api.contextType() - To find out, for which type of document (the type code) it was now executed. The value can be e.g., "Q".

In the table, you can see that a creation workflow logic, which builds 3 steps, will be executed 4 times (each line represents one execution), and what values are available to the logic on the current item.

Button clicked (caused logic execution)

Creation Workflow Status

Creation Workflow Current Step

Creation Workflow Step Label

Creation Workflow Step Count

Buttons on screen after execution

Button clicked (caused logic execution)

Creation Workflow Status

Creation Workflow Current Step

Creation Workflow Step Label

Creation Workflow Step Count

Buttons on screen after execution

Start CW

INPROGRESS

0

null

null

Next Step

Next Step

INPROGRESS

1

My Step 1

3

Back, Next Step

Next Step

INPROGRESS

2

My Step 2

3

Back, Finish

Finish

FINISHED

2

My Step 3

3

 

  • Expected logic execution outcome:

    • The result of the first element which returns an object of type CreationWorkflowDefinition will be used as a definition of the creation workflow. Note certain specific actions that you can do:

      • If the returned creation workflow is empty (no steps), it will finish immediately.

      • You can request that Document Creation Workflow moves to a specified step, regardless of what the user clicked in the UI (via the method resetCurrentStepTo()).

    • Throw Exception to prevent the creation workflow to be started or move to the next step. Some examples of reasons:

      • Some input field was not filled by the user.

      • The user who submitted the step, is not allowed to do it.

Configuration

  • To enable the document creation workflow feature, you must allow it using the option Enable Creation Workflow that can be found on the page Administration › Configuration › System Configuration › My Workflows › Enable Creation Workflow.

  • You can associate a creation workflow logic with a header type (introduced in version 14.0). This setting has preference over the default creation workflow logic. If you select a creation workflow logic in a header type but do not enable the creation workflow feature, creation workflow is executed only for documents based on that header type.

  • If no creation workflow logic is associated with header type and more creation workflow logics exist, the system will select the one, which is active, and its ValidAfter is closer to the targetDate of the execution of the logic (which is always "today" date).

  • You can also modify the behavior using checkboxes on the page Administration › Configuration › Quoting › Quoting General Settings:

    • Run document creation workflow logic on save

    • Submit on Creation WF finish and restart the last state when denied or withdrawn

Code sample

Create a simple workflow where one user and a user group cooperate on document creation:
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)

Found an issue in documentation? Write to us.

Â