Skip to main content
Version: 2.2.0

Fetches the value of a workflow attribute

To get the value of an attribute in a workflow, use the getAttributeValue method and enter the attribute ID # as parameter.

The code for that would be:

getAttributeValue("attribute_ID #")

This method will return the value of the desired attribute. If the attribute is of the List type with multiple options, the method will return an array with the corresponding values.

Examples​

See below examples of how to fetch the value of attributes with different types:

1. Time-type attribute​

$value = $workflow_api->getAttributeValue("Attribute-Time");

In this example, the getAttributeValue method will return the value of the time-type attribute.

The method returns a string in the "HH:MM"_ format (e.g.: 08:00)_, which represents the time recorded in the attribute.

2. Date-type attribute​

$value = $workflow_api->getAttributeValue("Attribute-Date");

In this example, the getAttributeValue method will return the value of the date-type attribute.

The returned value will be a string in the "YYYY-MM-DD"_ format (1999-01-01)_, representing the date recorded in the attribute.

3. Decimal-type attribute​

$value = $workflow_api->getAttributeValue("Attribute-Number");

In this example, the getAttributeValue method will return the value of the decimal-type attribute.

The returned value will be a decimal number (e.g.:1234.56000000), representing the value of the attribute. It is possible for the value to contain trailing zeros because the returned value maintains the precision defined for the attribute.

4. Text-type attribute​

$value = $workflow_api->getAttributeValue("Attribute-Text");

In this example, the getAttributeValue method will return the value of the text-type attribute.

The returned value will be a string (e.g.: ABC) representing the value of the attribute.

5. List-type attribute​

$value = $workflow_api->getAttributeValue("Attribute-List");

In this example, the getAttributeValue method will return the value of the list-type attribute.

The returned value will be a string (e.g.: Value 1) representing the value of the attribute.

Return example: ``

6. Attribute of the "List of values" type with multiple values​

$value = $workflow_api->getAttributeValue("Attribute-Multi-Value");

In this example, the getAttributeValue method will return the value of the attribute of the "List of values" type with multiple values, and will return an array with the values of the attribute.

Return example: array( [0] => Value 1 [1] => Value 2)