I would like to batch calculate two attributes in selected features in a feature layer (the layer data source is a feature service). My function is below. IGPResult returns "Enumeration yielded no results" error message and the fields are not being updated. Is there anything wrong with the code, specifically the list of arguments being passed to the tool? Thanks!
----------------------------------------------------------------------------------------------------------------------------------------------
private async Task UpdateLayerWithCalculateFields(FeatureLayer featureLayer, List<long> oids,
string field1value, string field2value)
{
QueryFilter filter = new QueryFilter() { ObjectIDs = oids };
featureLayer.Select(filter);
List<object> fieldArgs = new List<object> { new List<object> { "Field1", field1value }, new List<object> { "Field2", field2value } };
List<object> argsCalculate = new List<object> { featureLayer.Name, "PYTHON3", fieldArgs };
IGPResult result = await Geoprocessing.ExecuteToolAsync("management.CalculateFields", Geoprocessing.MakeValueArray(argsCalculate.ToArray()), null, null, null, GPExecuteToolFlags.None);
}