Hi everyone,
I have an attribute rule applied to fire whenever there is a new project from Project A that intersects with a project from Project B. This is applied with the 'update' trigger only, and not upon 'insert' and 'update' as it would generate a duplicate record, one for when the polygon was created, and another when attributes were created in the latter circumstance.
Here is a screenshot of the relationship table that I am updating via attribute rules.

In the screenshot above, RID 129 was created first when I created the Projects A polygon and populated a few attributes which is what I want.
RID 130 was created in the table after, when I updated a project_name in the same Projects A polygon.
Is there any logic I could incorporate into my attribute rule arcade script that would check for values in the relationship table and just update the existing record upon update, and not generate a whole new record/row in the relationship table every time a polygon is updated? The relationship table only has those few attributes that I have shown in the screenshot.
var fs = FeatureSetByName($datastore, "Project_B");
var fsInt = intersects(fs, $feature);
var payload = [];
var c = 0;
for (var proj in fsInt)
{
payload[c++] = {"attributes": { "PROJECT_NAME": $feature.project_name, "PROJA_NUM": $feature.proja_num, "PROJB_NUM": $feature.projb_num} }
}
return {
"edit": [{"className": "Relationship_Class",
"adds": payload
}]
}