Workflow Notes

Running Post Step Logic with No Workflow

It is possible to run a Workflow Post Step Logic even when there is no workflow defined. This can be useful when you want to take advantage of the logic context built around the workflow, yet you do not need the approval workflow.

The prerequisite is that you define a post step logic in Advanced Configuration Options. As a key in JSON, you need to use the same names of entities as in the workflow email, e.g. pricegriditem for a (Matrix) Price Grid Item; as a value in JSON use the name of the post step logic that will be run.

Property name:

postStepLogicsWhenNoWorkflowDefined

Value:

{"pricegriditem":"pricegriditem_without_workflow"}

Then you need a logic with a single element containing this Groovy script (id and priceGridId must be supplied):

def id = api.currentItem("id") def priceGridId = api.currentItem("priceGridId") api.update(api.currentItem("key2") == null ? "PGI" : "XPGI", [ id : id, priceGridId : priceGridId, attribute1 : 10000 ])

For this use case we do not provide any variables for the Groovy sandbox due to performance reasons. The item is available in api.currentItem(), and you need to be careful not to execute the full to-json conversion; instead you should pick only the fields you need (otherwise the performance may suffer).

Running Post Step Logic with No Approval Steps Generated

If you need to run a post step logic even if the workflow logic is executed but it does not generate any steps, there is a new method on workflowDTO withRunDefaultPostApprovalStepLogicOnEmptyWorkflow(boolean). When you call it with true, the logic specified in withDefaultPostApprovalStepLogic(String) will be also run in this case.

Any code in myDefaultPostStepLogic will be run too. 

Approvable Keys Persisted in Workflow Object

It is newly possible to get keys of the approvable that triggered the workflow. For example, when a PGI or XPGI are submitted, their keys (sku and key2 respectively) are persisted to the workflow object. When accessing from logic, they are available as a map of name keys, e.g.:



Found an issue in documentation? Write to us.

 
Pricefx version 12.0