You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Yes.
When FormElements with no editableExpression contained in FormInfo.formElements are submitted via {Map}.content.update_layer, the update will post successfully. However, when opened in FieldMaps, the user is prompted with an ambiguous error message. In FieldMaps Designer, the "Editable" checkbox is populated, when the form is not actually editable.
Message seen when attempting to edit feature in Field Maps
State of form configuration GUI in Field Maps Designer - note "editable" checkbox, no other warnings here.
I spent several days triaging this issue on my end, and it wasn't until I used ArcGIS Assistant to compare the JSON in a map created manually with those created via python api that I realized editableExpression was not populated.
Upon explicitly defining editableExpression in my code that creates FormFieldElements, the form worked within Field Maps.
fromarcgis.mapimportMapdefconfigure_date_form(field: dict, vizex: FormExpressionInfo=None):
returnFormFieldElement(
fieldName=field["name"],
label=field["alias"],
inputType=FormDatetimePickerInput(includeTime=False),
visibilityExpression=vizex.name,
preserve_field_values_when_hidden=True,
editableExpression="expr/system/true"# This should be instantiated by default, or handled by AGOL to default to true
)
wm=Map()
fori, lyrinenumerate(wm.content.layers):
### Loop configure_date_form over date fields to create a list called "form_elements"
...
form_info=FormInfo(formElements=form_elements, expressionInfos=expression_infos, preserveFieldValuesWhenHidden=True)
wm.content.update_layer(i, form=form_info)
Describe the solution you'd like FormElement object should initialize with a default editableExpression value.
Describe alternatives you've considered
Manual FieldMaps Designer - not appropriate here given high volume of FormElements we need to create
Additional context
I noticed default behavior of FormFieldElement with uninstantiated editableExpression is to set editable to true in AGOL json object. However I also noticed this editable attribute is not in the FormFieldElement dataclass, nor is it created by FieldMaps Designer. I am not familiar enough with the Forms rest endpoints to confirm if this should be valid, but if it is actually expecting editableExpression, not editable then this may be best categorized as a bug instead of a feature request.
@ccone-pattern Thanks for reporting this, it seems based on the dataclasses derived from the webmap specifications that the editable expression is part of a FormFieldElement as you correctly observed.
I will reach out to the team who works with this to get some clarity because the doc states: "A reference to an Arcade expression that returns a boolean value. When this expression evaluates to true, the element is editable. When the expression evaluates to false the element is not editable. If the referenced field is not editable, the editable expression is ignored and the element is not editable."
And we are not the ones setting the editable property in the json so that seems to be evaluated by AGOL.
Is your feature request related to a problem? Please describe.
Yes.
When
FormElements
with noeditableExpression
contained inFormInfo.formElements
are submitted via{Map}.content.update_layer
, the update will post successfully. However, when opened in FieldMaps, the user is prompted with an ambiguous error message. In FieldMaps Designer, the "Editable" checkbox is populated, when the form is not actually editable.Message seen when attempting to edit feature in Field Maps
State of form configuration GUI in Field Maps Designer - note "editable" checkbox, no other warnings here.
I spent several days triaging this issue on my end, and it wasn't until I used ArcGIS Assistant to compare the JSON in a map created manually with those created via python api that I realized
editableExpression
was not populated.Upon explicitly defining
editableExpression
in my code that createsFormFieldElements
, the form worked within Field Maps.Describe the solution you'd like
FormElement
object should initialize with a defaulteditableExpression
value.Describe alternatives you've considered
Additional context
I noticed default behavior of
FormFieldElement
with uninstantiatededitableExpression
is to seteditable
totrue
in AGOL json object. However I also noticed thiseditable
attribute is not in theFormFieldElement
dataclass, nor is it created by FieldMaps Designer. I am not familiar enough with the Forms rest endpoints to confirm if this should be valid, but if it is actually expectingeditableExpression
, noteditable
then this may be best categorized as a bug instead of a feature request.arcgis-python-api version: 2.4.0
env:
conda install -c esri arcgis arcgis-mapping
python: 3.12.7
os: Windows 64x
The text was updated successfully, but these errors were encountered: