AnsweredAssumed Answered

Set Field as Read Only in Attribute Inspector, but remain editable by Editor Widge

Question asked by mkoneya on Oct 15, 2012
Latest reply on Oct 18, 2012 by mkoneya
We have an application which allows users to edit Feature Classes in SDE via a Feauture Server.     We have a uniqure identifier field called "Asset_ID" in ten feature layers that will be populated with a unique number each time a feature is added using code similar to that below:

  //Added to update asset_id in feature before editing
            function beforeEdit(layer) {
                dojo.connect(layer, "onBeforeApplyEdits", function (adds, updates, deletes) {
                    dojo.forEach(adds, function (add) {
                        add.attributes.Asset_ID = 1234;



I would like the Asset_ID field to be read-only to the user so I tried to set the Read Only property for Asset_ID in the MXD when publishing the feature service,   but then my code does not update the field, which makes sense so I have to set the read-only property to "no" for the field in the MXD.

I then tried to change fieldInfos property for Asset_ID to 'isEditable':true for the Feature Layers used by the Attribute Inspector, but the problem I found was that I had to specify each field in the fieldInfos collection that I would like to show in the Attribute Inspector, but our feature classes have different attributes so I feeld it would be cumbersome to handle ten feature layers in this manner.

How can I update the Asset_ID field while showing it as Ready-Only in the Attribute Inpsectore and aslo prevent the user from changing its value.

Thanks for any assistance.