/
Document Creation Workflow

Document Creation Workflow

Document creation workflow is useful if you expect more users to cooperate on creating a document (a Quote, Agreement/Promotion, Rebate Agreement or Compensation Plan), before it is submitted for approval. The co-authors of the document can work on the document and the document can be moved in the workflow back and forth until it is finished. A review step can be inserted into the workflow, which allows you to ask users to review specified line items.

To use this feature, follow these steps:

  1. Enable document creation workflow in Administration > Configuration > My WorkflowsEnable creation workflow. This enables creation workflow globally, for all documents created in the module. You can, however, enable creation workflow only for a specific header type (Quote Type, Compensation Type, etc.) by selecting a creation workflow logic when you create the Type.

  2. Go to the Administration > LogicsGeneric Logic menu and create a calculation logic (see the guidelines below).

  3. Associate this logic with a Quote Type, Agreement & Promotion Type, Rebate Agreement Type or Compensation Type. If no logic is specified, the system will always search for and use the most recent, valid and active logic.

  4. Initialize the workflow by clicking the Start CW button in the Quote, Agreement/Promotion, Rebate Agreement or Compensation Plan detail view.
    Forward the document to other users in the workflow using the Back and Next Step buttons. In a review step, edit, approve or reject line items assigned to you.

    • Note that there is no change tracking, so there is no way to see what other users changed. There is, however, a conflict resolution functionality in the review step.

    • Your pending creation workflows are listed in a panel on the Home page. The CW status (Draft - In Progress - Finished) and label are displayed in the Quote, Agreement/Promotion, Rebate Agreement or Compensation Plan list table and in the header info.

  5. As soon as the work on the document is completed, it can be submitted for approval the usual way. You can also configure automatic submission after the document creation workflow is completed.

Guidelines for Building the Logic

  • The creation workflow logic is a generic logic whose 'Nature' is set to Creation Workflow.

  • The logic must contain a creationWorkflow definition with creation workflow steps. The document (Quote, Agreement/Promotion, Rebate Agreement, Compensation) can be referenced in the logic using api.currentItem(). If there are more elements with creation workflow definition, the system will use the first one that returns an instance of the creation workflow.

  • In the workflow step definition, you can assign the step to a user or a user group. Users will receive email notifications (configurable) and they will see a list of their pending creation workflows on the home page. You can also add watchers (users or user groups) – they will be notified by email when a creation workflow step changes.

  • You can allow Document Creation Workflow to automatically finish if it is generated with no steps. (See the last example below.)

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

  • You can also assign multiple creators to a single workflow step using the methods withUserAssignees and withUserGroupAssignees.

  • You can also set a step label (up to 255 characters) that will be visible to users in the UI.

See also the section Creation Workflow Logic in the Developer Knowledge Base.

Examples

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)

In the following example, the document is locked for editing for everyone until the creator finishes it and forwards it to the next step. As the workflow is run automatically on every save (set in Configuration), the method withShouldSendNotification prevents sending a notification to the creator on the first save (the document has typedId null before it is saved).

if (!api.isInputGenerationExecution()) { if (api.currentItem("typedId") != null && api.currentItem('creationWorkflowStepLabel') == "Creator step" && api.currentItem('createdBy') != api.user().id) { api.throwException("Only creator can modify the quote in the creator step!") } } def creator = api.currentItem("typedId") != null ? api.find("U", Filter.equal("id", api.currentItem('createdBy')))[0] : api.user() def step1 = api.newCreationWorkflowStep() .withLabel("Creator step") .withUserAssignee(creator.loginName) .withShouldSendNotification(api.currentItem("typedId") != null) def step2 = api.newCreationWorkflowStep() .withLabel("Input params") .withUserGroupAssignee("SalesEMEA") api.newCreationWorkflow() .withSteps(step1, step2)

The following example shows how to let Document Creation Workflow automatically finish if it is generated with no steps and move it to a specified step.

def isCwfType1 = api.currentItem('creationWorkflowStepCount') == 1 def isCwfType2 = api.currentItem('creationWorkflowStepCount') == 2 def cwfType1TriggerCondition = false // some computed value def cwfType2TriggerCondition = true // some computed value if (cwfType2TriggerCondition) { // cwfType2 has precedence over cwf type1 if both conditions are met cwfType1TriggerCondition = false } def theCwf if (/* it should not create cwf at all and finish immediately */ false) { // some computed value theCwf = api.newCreationWorkflow() } else { if (cwfType2TriggerCondition) { def costsStep = api.newCreationWorkflowStep() .withLabel("Costs step") .withUserGroupAssignee("thegroup") def dummyCustomerStep = api.newCreationWorkflowStep() .withLabel("Dummy customer step") .withUserGroupAssignee("thegroup") theCwf = api.newCreationWorkflow() .withSteps(costsStep, dummyCustomerStep) } else if (cwfType1TriggerCondition) { def otherStep = api.newCreationWorkflowStep() .withLabel("Some other step") .withUserGroupAssignee("thegroup") theCwf = api.newCreationWorkflow() .withSteps(otherStep) } // else theCwf remains null, and it won't be finished if ((isCwfType1 && cwfType2TriggerCondition) || (isCwfType2 && cwfType1TriggerCondition)) { theCwf.resetCurrentStepTo(0) } } return theCwf

Review Step

This feature streamlines the process of managing and reviewing the content of approvable documents (Quotes and Agreements/Promotions in version 14.0) by enabling efficient, structured teamwork. Designed for back-office managers and domain experts, this feature supports a seamless transition through multiple stages of document creation, review and approval.

The workflow begins with the back-office manager creating the document, filling in basic information, adding line items, and assigning them to specific groups for review. In the next phase, domain experts collaborate within a parallel (or sequential) workflow, where they provide input on the draft document. The system ensures that reviewers see only the line items relevant to their expertise through advanced filtering, offering a focused and efficient review process. Reviewers also receive automatic notifications (by email and in the notification center) that their input has been requested.

Line items for review are displayed on the Items for Review tab, with other items available on the Other Items tab in a read-only format. Reviewers can edit and approve items as needed, with the flexibility to involve multiple user groups at each review stage. Steps can be defined as parallel or sequential, and the system includes conflict resolution functionality via a pop-up window for handling concurrent edits. Once the review process is complete, the document is submitted to the next step in the document creation workflow.

Note: If there are no line items in the document, the review step is automatically skipped in the document creation workflow.

DCW01.png

In the review step, only the Items for Review, Other Items and Messages tabs are visible by default. The available action buttons are Review Done, Recalculate and Comments on the tab level and Comment, Accept, Reject when an item is selected. The visibility of tabs and buttons can be changed by administrator via the JSON configuration.

On the Items for Review tab, users see only items relevant to them (filtered by user group in the creation workflow logic).

Line Item Comments

The line item commenting feature enables threaded discussions tied to specific line items. Threads can be assigned to one or more line items, with multiple threads allowed per item. Comments include metadata such as author, creation date, and last edited date. Threads can be marked as resolved/unresolved, and comments can be edited or deleted for flexibility and traceability.

DCW02.png

Resolved comments disappear from the Comments panel but can be displayed again by clicking the 3 Dots icon and selecting the Show resolved option.

Concurrent Editing

In a situation, when two or more reviewers edit a line item at the same time, the following behavior applies:

  • If the users modify the same input of a line item to the same value, then there is no version conflict and the change is applied.

  • If the users modify the same input to a different value, then for the user who made the change later, the Resolve Conflict dialog is displayed showing the line item and input with his/her change and the change made by the other user. Then the user has to to decide whether to apply or discard the change.

  • If each user modifies a different input, all the changes are applied.

Logics

Configuration of a review step as part of the document creation logic:

A variation of the previous with sequential instead of parallel review steps. Members of “Review Group 2” will be able to start their review only when “Review Group 1” has completed their review:

Layout Customization

By default, only certain tabs are visible in the collaboration workflow review step. If there is tab definition for a header type, it is possible to hide tabs in the collaboration workflow review step by using the hiddenCheck parameter in the JSON configuration of the related Quote Type.

Example showing how to hide the Attachments tab:

You can download the default JSON configuration file and adjust it according to your needs:

 

Found an issue in documentation? Write to us.

 
Pricefx version 14.0