Set lineitem field from lineitem field expression

Workflowtaskslineitemtolineitem

workflow task editing workflow task editing
This workflow task allows you to define an expression with functions and lineitem fields and assign the result to a lineitem field.
The task is only for inventory modules: Quotes, Sales Orders, Invoices, and so on.
The task form allows you to define an expression of formulas and lineitem field names to produce a value to be inserted into a target lineitem field. There is a pop-up window with all available functions and fields.
It is very important to remember, for complex expressions, that every function and sub-expression must be enclosed in parentheses.

Calculated value (expression)

Let’s see in detail

Functions

  • concat(fieldA, fieldB, …): concatenates fields separated by commas. You can also insert a function in place of the field or a string

  • time_diffdays([datefieldA], datefieldB): calculates the difference, in days, between dates contained in datefieldA and datefieldB. Parameter “datefieldA” is optional, if omitted the reference date is the execution date

  • time_diff([datefieldA], datefieldB): calculates the difference, in seconds, between dates contained in datefieldA and datefieldB. Parameter “datefieldA” is optional, if omitted the reference date is the execution date

  • add_days([datefield], days): adds a number of days (days) to the date contained in the datefield field. Parameter “datefield” is optional, if omitted the reference date is the execution date

  • sub_days([datefield], days): subtracts a number of days (days) from the date contained in the datefield field. Parameter “datefield” is optional, if omitted the reference date is the execution date

  • add_time([timefield], minutes): adds a number of minutes (minutes) to the data contained in the datefield field. It returns only time part. Parameter “timefield” is optional, if omitted reference date is the execution time

  • add_time_wdate([timefield], minutes): adds a number of minutes (minutes) to the data contained in the datefield field. It returns date and time part. Parameter “timefield” is optional, if omitted reference date is the execution time

  • sub_time([timefield], minutes): subtracts a number of minutes (minutes) from the date contained in the datefield field. It returns only time part. Parameter “timefield” is optional, if omitted reference date is the execution time

  • sub_time_wdate([timefield], minutes): subtracts a number of minutes (minutes) from the date contained in the datefield field. It returns date and time part. Parameter “timefield” is optional, if omitted reference date is the execution time

  • get_datetime(‘Y-m-d H:i:s’): the current date-time formatted by PHP rules https://www.php.net/manual/en/datetime.format.php

  • Today: the date in which the task is executed

  • Tomorrow: date for the day following the execution of the task

  • Yesterday: the date of the day preceding the execution of the task

  • intval(field): the integer number of the value contained in the field (also string)

  • floatval(field): the decimal number of the value contained in the field (also string)

  • integerformat(field): formats an integer number in the user format

  • floatformat(field): formats a decimal number in the user format

  • dateformat(field): formats, in the user format, the date contained in the field

  • timeformat(field): formats a time value in the user format

  • daytimeformat(field): formats “date time” value in the user format

  • boolean(‘true’|’false’): returns a boolean value ‘true’ or ‘false’

  • currencyformat(field): format the currency value and add currency symbol

Specials

  • Currency symbol: inserts the currency symbol

  • Currency name: inserts the currency name (eg EURO)

  • Currency code: inserts the currency code (eg EUR)

  • Double quotes: inserts the double quotes (“)

  • Single quote: inserts the single quote (‘)

  • HTML break: inserts a HTML break for the WYSIWYG

  • Text new line: inserts a new line for textarea

  • If … Then … Else: inserts a conditional statement If (condition) then expression else expression end. The condition If (condition) can be a camparison of two expressions with operators: ==, <, <=, >, >=

Fields

The available fields are all fields configured for the inventory module

Target: lineitems field

The target field where the expression result will be saved.

Entity filter

Allows you to select a filter, previously created, of the module you are assigning the task.
This filter allows you to apply further filtering, in addition to the one already available in the workflow, to filter the records on which to perform the task.

Lineitem type filter

Allows you to filter the lineitems on which to execute the task.
The filter is defined in the lineitem type module, Products / Services.
Lineitems not selected by the filter will remain unchanged.

Lineitems filter

As for Lineitem type filter, this filter also defines which lineitems the task is applied to.
The difference is that, in this case, the filter (max 3 AND conditions) works on the values of the lineitem fields.

Add new rule

Allows you to add one or more rules to create tasks for assignments to different entity fields in the same workflow task.