When I update site_p I want the correlating fields in site_a to be updated as well. The relationship class is realated on the field "rpsuid"
Here is my code:
// Step 1: Get the related records from site_a using the correct relationship class name
var relatedRecords = FeatureSetByRelationshipName($feature, "usar_hq.rd_81.Site_P_Site_A", [], false);
// Step 2: Get the first related record
// Explanation: We use the First() function to get the first record from the related records.
var related_record = First(relatedRecords);
// Step 3: Check if a related record is found
// Explanation: We check if related_record is null. If it is, we return null to stop further processing.
if (related_record == null) {
return null;
}
// Debugging: Print the related record
Console("Related record: " + Text(related_record));
// Step 4: Populate fields in the main feature class with fields from the related record
// Explanation: We create an object to return the desired fields from the related record.
return {
"debug_field": related_record.debug_field
// Add more fields as needed
// Uncomment and modify the lines below to include additional fields
// "accountableorganization": related_record.accountableorganization,
// "anotherfield": related_record.anotherfield
};
and I get this error:
Edit operation failed.
Message: Unable to complete operation.
Details: Internal error during object update. Undefined keyword is used in the dictionary return script. [
Rule name: Site_p2a,
Triggering event: Update,
Class name: Site_P,
GlobalID: {AAF25529-13CD-448C-BDC2-C83DE21711EF}], Undefined keyword is used in the dictionary return script. [debug_field]
debug_field does exist in the feature class and service. What am I doing wrong? I am sure it is a stupid syntax error on my part.