Adding attachments to layers.

203
2
10-11-2020 01:10 PM
RomanKohut
New Contributor

When I try to add attachments to a layer, I get the following error in response:

error

Code:

Perhaps someone has encountered this error? 

0 Kudos
2 Replies
ManishPatel
Esri Contributor

Hi Roman Kohut,

By the look of the error it looks like the layer doesnt support global ids, please refer to the documentation at link Apply Edits (Feature Service/Layer)—ArcGIS REST API | ArcGIS for Developers for more information.

supportsApplyEditsWithGlobalIds will be true if the layer supports applying edits. 

The documentation also states if useGlobalIds is true, the features are added while preserving their globalIds. If useGlobalIds is false or not specified, the globalIds submitted with the features are ignored and the service assigns new globalIds to the new features.

Please feel free to share codepen with your example which will be easier for verifying if there is any change in code required.

Hope this helps.

Cheers,

Manish

 

If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.

Cheers,
Manish
0 Kudos
RomanKohut
New Contributor

Hi. You can see the function that is responsible for adding an attachment to the layer - https://codepen.io/RomanMainn/pen/XWKmNOx?editors=0010. Where should I add the supportsApplyEditsWithGlobalIds property?

Also please note, I was guided by the documentation for this link: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdi....

0 Kudos