I have a structure of record type A like this:
{id:
other business field:,
relationships:
record Type2: {
id,
A_id,
other business field
}
recordType3:
{
},
After user change the data, I want to check whether the business field is actually modified. What I thought is to traverse the list of this record and construct new objects using the business field, use the new objects to compare. I want to know is this the only way to solve my problem? Is there any easy way can solve this.
Discussion posts and replies are publicly visible
For detecting business field changes in your record, store the original record when the form loads, then use direct field comparison. Simply compare original.otherBusinessField <> current.otherBusinessField for each business field you care about. This is much more efficient than traversing and reconstructing objects. You can wrap this in a reusable rule that returns true/false for whether any business fields changed. For real-time tracking, add change flags in your saveInto parameters. Avoid object reconstruction - direct comparison is faster, simpler, and more maintainable.Give it a try..
both the original data and new data are list, I want to use symmetricdifference() to compare the original data and the new data, so I try to reconstruct the objects,
I'm having a hard time understanding this. Since you only need to find out whether the business field has been modified or not (true/false), you can directly use symmetricDifference() for this. Why are you traversing and constructing a new object?length( symmetricdifference( local!originalArray, local!updatedArray ) ) <> 0
length( symmetricdifference( local!originalArray, local!updatedArray ) ) <> 0
because the original data has ID field, if user remove the original data and add a same data, the id field is different, symmetricdifference() thinks they are different, But what I want is they should be same.