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.
workflow .withDefaultPostApprovalStepLogic("myDefaultPostStepLogic") .withRunDefaultPostApprovalStepLogicOnEmptyWorkflow(true)
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.:
api.find("W")[0].keys == [sku: "sku of my xpgi", key2: "key2 of my xpgi"]
Found an issue in documentation? Write to us.
Â
Pricefx version 13.1