26
Views
3
Comments
Solved
Entity update behavior "changed attributes" ignores change to 0
Application Type
Service

I have the following situation.

  • In a server action I fetch a record with an aggregate
  • I change a currency attribute value to 0
  • The entity update behavior is set to "changed attributes"
  • I update the record

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

  • Change the atttibute value to 1 instead of 0 -> the value is updated!
  • Entity update behavior set to "all attributes" -> the value is updated!

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!

2020-09-04 11-39-50
Rogier Olde Dubbelink
Solution

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.

2025-12-29 06-17-15
Deepak Raj M

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)


2025-12-03 17-22-41
Lavanya Kamalaguru

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?


2020-09-04 11-39-50
Rogier Olde Dubbelink
Solution

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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.