Pricefx Classic UI is no longer supported. It has been replaced by Pricefx Unity UI.
Document Creation Workflow
Document creation workflow is useful if you expect more users to cooperate on creating a document (Quote, Agreement/Promotion or Rebate Agreement), before it is submitted for approval. The co-authors of the document can work on the document each at a time and the document can be moved in the workflow back and forth until it is finished.
To use this feature, follow these steps:
- Enable document creation workflow in Configuration > Workflows > Enable creation workflow for document type.
- Create a calculation logic (see the guidelines below). The system will always search for and use the most recent, valid and active logic.
- Initialize the workflow by clicking the Start CW button in the Quote / Agreement/Promotion / Rebate Agreement detailed view.
Forward the document to other users in the workflow using the Back and Next Step buttons.- Note that there is no change tracking, so there is no way to see what other users changed.
- Your pending creation workflows are listed in a panel on the Home page. The panel can be enabled/disabled in Configuration. The CW status (Draft – In Progress – Finished) and label are displayed in the Quote, Agreement/Promotion or Rebate Agreement list table and in the header info.
As soon as the work on the document is completed, it can be submitted for approval the usual way.
Guidelines for Building the Logic
- To create a workflow logic, go to the Configuration > Calculation Logic > Generic Logic menu. The Nature of the logic must be set to Creation Workflow.
- The logic must contain a creationWorkflow definition with creation workflow steps. The document (Q/CT/RBA) 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
andwithUserGroupAssignees
. - You can also set a step label (up to 255 characters) that will be visible to users in the UI.
Examples
A simple workflow where one user and a user group cooperate on document creation:
return api.newCreationWorkflow() .withSteps(api.newCreationWorkflowStep() .withLabel("Add Products") .withUserAssignee("Bill.Greene"), api.newCreationWorkflowStep() .withLabel("Input params") .withUserGroupAssignee("SalesEMEA") )
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).
api.logInfo("typId", api.currentItem("typedId") + " " +api.currentItem('creationWorkflowCurrentStep')) if (!api.isSyntaxCheck()) { 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() api.newCreationWorkflow() .withSteps(api.newCreationWorkflowStep() .withLabel("Creator step") .withUserAssignee(creator.loginName) .withShouldSendNotification(api.currentItem("typedId") != null), api.newCreationWorkflowStep() .withLabel("Input params") .withUserGroupAssignee("SalesEMEA") )
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 immediatelly */ false) { // some computed value theCwf = api.newCreationWorkflow() } else { if (cwfType2TriggerCondition) { theCwf = api.newCreationWorkflow() .withSteps(api.newCreationWorkflowStep() .withLabel("Costs step") .withUserGroupAssignee("thegroup"), api.newCreationWorkflowStep() .withLabel("Dummy customer step") .withUserGroupAssignee("thegroup") ) } else if (cwfType1TriggerCondition) { theCwf = api.newCreationWorkflow() .withSteps(api.newCreationWorkflowStep() .withLabel("Some other step") .withUserGroupAssignee("thegroup") ) } // else theCwf remains null, and it won't be finished if ((isCwfType1 && cwfType2TriggerCondition) || (isCwfType2 && cwfType1TriggerCondition)) { theCwf.resetCurrentStepTo(0) } } return theCwf
Found an issue in documentation? Write to us.