Edits the value of a workflow form field
To edit the value of a workflow form field, use the setEntityAttributeValue
method and enter these parameters: ID # of the entity to which the form belongs,
entity attribute ID #, and the new value.
$workflow_api->setEntityAttributeValue("Entity ID #", "Entity attribute ID #", "New value");
Examples
1. Updating a Boolean-type attribute
$workflow_api->setEntityAttributeValue("ENT01", "fgboolean", "1");
In this example, the setEntityAttributeValue
method is updating the value of
the attribute identified as "fgboolean" in the entity identified as "ENT01" to
"1", which corresponds to the checked option.
For attributes of the Boolean type, the possible values are "0" for the unchecked option, and "1" for the checked option.
2. Time-type attribute
$workflow_api->setEntityAttributeValue("ENT01", "hrtime", "20:00");
In this example, the setEntityAttributeValue
method is updating the value of
the attribute identified as "hrtime" in the entity identified as "ENT01" to
"20:00", which corresponds to time in the "HH:MM" format.
For attributes of the Time type, the new value must be in the "HH:MM" format, where HH represents the hour, and MM represents the minutes.
3. Integer-type attribute
$workflow_api->setEntityAttributeValue("ENT01", "vlinteger", "123456");
In this example, the setEntityAttributeValue
method is updating the value of
the attribute identified as "vlinteger" in the entity identified as "ENT01" to
"123456", which corresponds to an integer.
For attributes of the Integer type, the new value must be an integer with no decimal places.
4. Text-type attribute
$workflow_api->setEntityAttributeValue("ENT01", "nmtext", "ABC");
In this example, the setEntityAttributeValue
method is updating the value of
the attribute identified as "nmtext" in the entity identified as "ENT01" to
"ABC", which corresponds to a text.
For attributes of the Text type, the new value can be a sequence of characters.
5. Date-type attribute
$workflow_api->setEntityAttributeValue("ENT01", "dtdate", "2019-07-31");
In this example, the setEntityAttributeValue
method is updating the value of
the attribute identified as "dtdate" in the entity identified as "ENT01" to
"2019-07-31", which corresponds to a date in the "YYYY-MM-DD" format.
For attributes of the Date type, the new value must be in the "YYYY-MM-DD" format, where YYYY represents the year, MM represents the month, and DD represents the day.
6. Decimal-number-type attribute
$workflow_api->setEntityAttributeValue("ENT01", "vlnumber", "1234.56");
In this example, the setEntityAttributeValue
method is updating the value of
the attribute identified as "vlnumber" in the entity identified as "ENT01" to
"1234.56", which corresponds to a decimal number.
For attributes of the Decimal number type, the new value must be a number with decimal places, separating the integer part from the decimal part with a dot ".".