Closed allisonmuise closed 7 years ago
Test Data: Crowdsource Polling App: http://ess.maps.arcgis.com/home/item.html?id=b63a745fa4034a7a8fef42a9b6b16d64
Web Map: http://ess.maps.arcgis.com/home/item.html?id=9aaf32cab1af46a9b037c46e1db3bb91
Hosted Feature Service: http://ess.maps.arcgis.com/home/item.html?id=df51e02e34504c11895f17a7dfe3764c
Schema for service was created using guidelines outlined in: Crowdsource Polling > Create layers > Moderate comments http://solutions.arcgis.com/local-government/help/crowdsource-polling/get-started/create-layers/#moderate
The field 'PublicView' has a domain applied with a default value of 'No' to help moderate comments (see screen shot ArcMapSchema.jpg). This field needs to remain hidden from users at all times, so that they do not have control over moderating their own comment when submitting.
Open the web map and note the pop-up configuration which carries over to the app configuration. In the related table, 'Comments' is set to Display when users view a feature and is also set to Edit so users can add new comments when submitting. The PublicView field should not be displayed or edited by the users, so both options are unchecked in the pop-up configuration.
Open the Crowdsource app > click a feature and submit a Comment > note only the Comment field is available (as expected) > Enter a Comment and click Submit
View the attributes of the related table in the service (Data tab in Item Details) and note the values in the PublicView field > a Null value has been applied to the PublicView field when the related records are created through the Crowdsource app.
In the web map > Configure pop-up on the related table > Enable 'Edit' for the PublicView field > Save changes to web map
Repeat steps 2 and 3 > Note that the default value is able to populate as expected when it is exposed in the editing form within the Crowdsource app. However, enabling editing on this field would defeat the purpose of moderating comments. For the moderate workflow to be effective, it seems like we will need the default value to populate even when Edit is disabled in the pop up configuration.
It seems like when the fields are exposed for editing, the Crowdsource app is able to refer to the 'template' details in the service definition and when it is disabled, the 'fields' info is being used instead. Additionally, after publishing a service from ArcMap the 'fields' info in the service does not match with what is seen in the field properties of the source data. The 'fields' info in the service definition always shows a default value of null for all fields. (see screenshots Template.jpg and Fields.jpg)
Same issue is seen in Crowdsource Polling app and Crowdsource Reporter app
This issue also seems related to [BUG-000099940: It is not possible to add new related records using the edit widget of Web AppBuilder when the fields in a related table are not nullable and are published as a hosted feature service.]
(#1567)
@allisonmuise
We have analyzed this issue and found that, we need to set the default values from the template in newly added comment. As you mentioned this issue exist in both Reporter and Polling app. However in Reporter we have handled this case for submitting issues but not handled for the comments.
@MikeTschudi we are planning to add this code from reporter
Please confirm.
@CTLocalGovTeam, possibly simpler approach in branch populate-noneditable-fields.
The DynamicForm was ignoring the default value when a field was not editable, so I just changed that.
@MikeTschudi @allisonmuise
This approach looks good. We will skip implementing this on our end.
@CTLocalGovTeam, thanks for review @allisonmuise, I'll merge it into develop
@CTLocalGovTeam I created an issue for 5.3 to address this for Reporter
@MikeTschudi - I see that this fix is in devtopia, but I'm still seeing the issue on devext.
@allisonmuise, would you please provide an example? It is working for me so far on devext.
@MikeTschudi It's working for me now, as well. might have been testing before the build yesterday.
Default values defined in the feature template are only honored on editable fields.
For example:
Field PUBLICVIEW in the table has a default value of 'Yes'. When PUBLICVIEW is editable, new related records get the value 'Yes' in the PUBLICVIEW field. When PUBLICVIEW is not editable, no value is written to the field.
http://localgovtest.maps.arcgis.com/apps/CrowdsourcePolling/index.html?appid=82ece884bd654b9c874ae4b575110b5d