I have the following situation.
The result is that this attribute still has the old value (others are updated though). I expected it to be stored with the 0 value.
I did the following experiments
Why can't I just change a value to 0 with update behavior set to "changed attributes"?
How can I work around it without updating all attributes?
Thanks!
Found the cause.
In fact I did not use an aggregate but a SQL Server node. It also returned a record, but it did not fetch the original record but it was populated partly with existing attribute values and partly with desired values calculated from different entities.
If you then call the record update action all attributes of the returned record are still marked as unchanged, even though they are different from the original values in the database. So they are not updated. Solution: configure the entity update behavior to all attributes, even though OutSystems advises not to.
HI,
Step 1: Fetch your record
Use an Aggregate or GetEntityById to retrieve the record.
Example:
GetEmployeeById.Employee
Step 2: Set the value
Assign the value you want:
GetEmployeeById.Employee.Salary = 0
Step 3: Force OutSystems to recognize the change
Before calling the UpdateEntity action, add this line in a Server Action:
EntityAttributeSetChanged(GetEmployeeById.Employee.Salary, True)
This built-in system action tells OutSystems: “Hey, I changed this attribute — include it in the update SQL.”
Step 4: Update the record
Call:
UpdateEmployee(GetEmployeeById.Employee)
Hi,
Please update the same value for all the attributes, except for the one you’re trying to modify.
In OutSystems, the Update action only updates the attributes whose values you explicitly pass to it.
If possible, could you please share your OML file so I can take a look?