Select to view content in your preferred language

Arcade referencing original feature broken after update

454
16
Wednesday
jmaxwell_braun
Frequent Contributor

We are getting errors for fields with Arcade calculated attributes after the Field Maps 2025.2 update. It appears to only affect expressions that use the $originalFeature variable. The error message is vague: "10 attributes failed". Was there anything in the latest update that would cause this? Thanks

Edit: Esri has determined this is a bug. BUG-000179854, Description: The $originalFeature function fails when creating a new feature in ArcGIS Field Maps version 25.2, but editing the existing feature is successful.

0 Kudos
16 Replies
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

My recommendation is to test whether the feature geometry has changed in comparison to the field values.

var fx = $feature.UTM_X
var fy = $feature.UTM_Y
var G = Geometry($feature)
if( G.x != fx && G.y != fy ){
    return { result: { attributes: Dictionary('UTM_X',G.x,'UTM_Y',G.y) } }
    }
/*
Note: the code above will update both fields with the changed values if
there are values that have been updated in the field.
*/

That way it will only need to compare the latest changes to the geometry change. If there is a change it will update accordingly.

0 Kudos
alexnJSI
Emerging Contributor

We are getting this issue in any Arcade calculated expressions within Field Maps Designer that call $originalFeature at any point (which is quite a few of them). The issue can be completely isolated from any other intrinsic functions/variables. 

Arcade exceptions are thrown whenever $originalFeature is referenced, including something as simple as 

var test = $originalFeature;

 and nothing else in the expression. 

0 Kudos
IngridHogle
Frequent Contributor

Can you try putting your expression inside an edit context condition like this (filling in an existing attribute for what I named value)?

var test = ""
 
//if this is a new feature
if ($editcontext.editType == 'INSERT') {
    test = "new feature test";
// if this is NOT a new feature,
} else if ($editcontext.editType == 'UPDATE'){
   test = $originalFeature.value;
}
return test
 
 
alexnJSI
Emerging Contributor

I did try wrapping any calls to $originalFeature inside of a check for an UPDATE context, but that didn't seem to resolve the error. The code: 

if ($editContext.editType == "UPDATE")
{
  var test = $originalFeature;
}
return false;

It does make sense to me that the variable would only be non-null and accessible outside of an INSERT context, but even an explicit wrapper for an UPDATE state produces the same error: 

[ARCADE] Expression failed to evaluate:

Name: expr9

Error: invalidArcadeExpression(details: "Arcade evaluation error. Evaluation_error_code::field_not_found Line: 1")

0 Kudos
IngridHogle
Frequent Contributor

I've never seen $originalFeature used by itself, so this is out of my league. I always use $originalFeature.something to get some information about the original feature, such as an attribute value, shape area, shape length, or x/y coordinate.

0 Kudos
alexnJSI
Emerging Contributor

We are also using it in that context, specifically to assess whether or not users have selected a different dropdown menu option. The example was just to simplify it as much as possible. 

Regardless of whether or not we are calling $originalFeature.attribute or even just $originalFeature on its own, the error persists. Any calls to $originalFeature in any context are what is causing the bug. 

0 Kudos
IngridHogle
Frequent Contributor

Roger that. Good luck! I feel lucky I was able to get all of my Arcade expressions working in 25.2.0 by just cleaning them up a bit last night. There have been no phone calls from the field today. Phew!

0 Kudos