Set entity field from entity fields expression

Workflowtasksentitytoentity

workflow task editing workflow task editing
This workflow task allows you to define an expression with functions and entity fields and assign the result to a entity field.
The task is for all entity modules.
The task form allows you to define an expression of formulas and entity field names to produce a value to be inserted into a target entity 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’

Specials

  • 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 module

Target 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.

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.