Skip to main content
Version: 2.2.2

Edits the value of a workflow attribute

To edit the value of a workflow attribute, use the setAttributeValue method, entering the attribute ID # and the new desired value as parameters.

The code for that would be:

Examples:​

See below examples of how to update the value of different attribute types:

1. Time-type attribute​

$workflow_api->setAttributeValue("Attribute-Time", "08:00");

In this example, the setAttributeValue method is updating the value of the attribute identified as "Attribute-Time" to the time "08:00".

For attributes of the Time type, the new value must be a string in the "HH:mm" format, where "HH" represents the hours, and "mm" represents the minutes.

2. Date-type attribute​

$workflow_api->setAttributeValue("Attribute-Date", "2019-07-31");

In this example, the setAttributeValue method is updating the value of the attribute identified as "Attribute-Date" to the date "2019-07-31".

For attributes of the Date type, the new value must be a string in the "YYYY-MM-DD" format, where "YYYY" represents the year, "MM" represents the month, and "DD" represents the day.

3. Number-type attribute​

$workflow_api->setAttributeValue("Attribute-Number", "1234.45");

In this example, the setAttributeValue method is updating the value of the attribute identified as "Attribute-Number" to the decimal number "1234.45".

For attributes of the Number type, the new value must be a string representing a decimal number, with or without decimal places, using dot (.) as decimal place separator.

4. Text-type attribute​

$workflow_api->setAttributeValue("Attribute-Text", "ABC");

In this example, the setAttributeValue method is updating the value of the attribute identified as "Attribute-Text" to the text "ABC".

For attributes of the Text type, the new value must be a string containing the desired text.

5. Attribute of the List type with multiple values​

$workflow_api->setAttributeValue("Attribute-Multi-Value", array("Value 1","Value 2"));

In this example, the setAttributeValue method is updating the value of the attribute identified as "Attribute-Multi-Value" to a list with multiple values. To do this, enter an array containing the desired values.

For attributes of the List type with multiple values, the new value must be an array containing the selected values.

caution

It is important to remember that the attribute ID # must be provided correctly and that the new value must be in the correct format for the attribute type.