Condition Expressions (Approval Workflow)

The Price Parameter ApprovalConditions is used to set up conditions under which the approval step will appear in the approval workflow.

Example of Conditions with Boolean expressions

Decisions when to add a step:

  • If there is no condition for a step, or all step’s conditions have the field Skip set to Yes, the step will always be added.

  • If there are more conditions for the same step, then all of them must be true, so that the step is added to the workflow.

This Boolean expression can consist of:

The rule for setting a condition for a header, line items or folder:

  • header.ElementName + condition

  • line.ElementName + condition

  • line.folder.ElementName + condition AND label == "folder name" (if any)

Note:

  • This rule is helpful when you have the same element names on both header and line item level – using a rule you can distinguish them.

  • header.ElementName and line.ElementName are only applied for the input or output. For example, you want to set a condition for Product Id (MB-0035), you have to set like this: sku == "MB-0035".

Examples:

  • An LPG does not contain a line item, so you can set ElementName + condition (suggested) or header.ElementName + condition.

  • A Price List contains a line item, so you can set ElementName + condition (suggested) or line.ElementName + condition.

Which fields, inputs and outputs will be available in the expression depends on what you are building the approval workflow for.

If there are multiple condition lines for one step, the conditions are combined using AND operator.

You can combine the condition of values on a header and line item, line item and line item of the same level within one condition row. But there is currently a limitation when combining a line item with another line item of a different level (folder), then you have to have two separate rows.

Process of Conditions Evaluation

When the system needs to build the approval workflow steps for certain document:

  1. It will execute the appropriate workflow logic based on the type of document.

  2. That workflow logic provides a name of the Workflow Type, which will be used to select/filter only the relevant steps and their conditions.

  3. All active conditions (i.e. their Skip field is not Yes) defined for that Workflow Type will be evaluated against the document and also against every its line items (when it has line items).

  4. Approval steps will be added to the approval workflow based on results of the conditions.

Fields Available in Expression

The condition can read values of the fields of the document simply by using the name of the field, e.g. sku, label, targetDate, unitOfMeasure, quoteType, attribute2, etc.

When the system evaluates the condition for a line item in a document which also has a header, then the fields from the line item and header are both available. For example, in a condition for a quote line item, you can refer to targetDate (from quote header) and also to sku (from quote line).

In rare cases where the field exists in both – item and header – the line field value will be used.

If you need to distinguish fields of the same name on different levels, you can use prefixes: header, folder, or line.

Values of Inputs and Outputs Available in Expression

Values provided by the user in the input fields and outputs (result values calculated by the logic and stored on the document) are available via their name (not labels), e.g. TotalRevenue, LocalPrice.

If you have inputs/outputs with the same names on the header and line item levels, you need to distinguish and use header and line prefix, e.g. header.Quantity, line.Quantity.

If you have an input and also output with the same name , you need to distinguish which one you want, e.g. line.inputs.Quantity, line.outputs.Quantity.

If an input field name is defined with spaces in the name, then you can put its name into quotes, e.g. line."Discount %". Note that you can do it only when using the prefix line or header.

Examples per Document Type

Here are some examples of what fields/input/outputs you can refer to in the condition expression.

Live Price Grid Item or Price List Fields/Inputs/Outputs

Please remember that Live Price Grid has approval workflow per line item, whereas Price List has a single approval workflow for the whole price list.

Field/output available in condition expression

Meaning of the value

Value comes from

Field/output available in condition expression

Meaning of the value

Value comes from

sku

Product ID

Price list/ LPG Line Item

label

Product Name

Price list/ LPG Line Item

unitOfMeasure

UOM

Price list/ LPG Line Item

currency

Product Currency

Price list/ LPG Line Item

resultPrice

Result Price

Price list/ LPG Line Item

manualResultPrice

Manual Override

Price list/ LPG Line Item

<ResultName>

Calculation result named <ResultName>

Price list/ LPG Line Item

line.<ResultName>

Calculation result named <ResultName>

Price list line item

header.<ResultName>

Calculation result named <ResultName>

LPG line item

Quote Fields/Inputs/Outputs

Field/output available in condition expression

Meaning of the value

Value comes from

Field/output available in condition expression

Meaning of the value

Value comes from

targetDate

Effective Date

Header

expiryDate

Expiry Date

Header

header.<InputName>

input field named <InputName>

Header

header.<ResultName>

calculation result named <ResultName>

Header

label

Product Name

Line/Folder

sku

Product Id

Line

quoteType

Quote Type

Line

line.<InputName>

input field

Line

line.<ResultName>

calculation result

Line

line.folder.<InputName>

input field named <InputName>

Folder

line.folder.<ResultName>

calculation result named <ResultName>

Folder

Rebate Agreement Fields/Inputs/Outputs

Field/output available in condition expression

Meaning of the value

Value comes from

Field/output available in condition expression

Meaning of the value

Value comes from

startDate

Start Date

Header

endDate

End Date

Header

payoutDate

Payout Date

Header

rebateType

Rebate Type

Line

line.<InputName>

input field named <InputName>

Line

line.<ResultName>

calculation result named <ResultName>

Line

Â