Issue retrieving feature layer

07-31-2022 11:22 PM
New Contributor III

Hello everyone, I am currently facing some issues retrieving my Feature Layer from the server directory. I am currently using ArcGIS API for JavaScript 3.41.

I have tried the following code however, there are some issues in retrieving the information I need. For eg. there are a few missing properties such as the id, info template, _fields within the layer itself.

Below are the 2 methods I have tried I am able to retrieve the layers however the properties are still undefined or empty. Am I missing any steps?

const layer = new FeatureLayer({ "" });

 var flayer = new FeatureLayer({
         portalItem: {
         id: item._id


3 Replies
New Contributor

How about posting the rest of your code?  Maybe set it up in CodePen?

0 Kudos
New Contributor III

Sorry.. the project is classified, but thanks for the reply..

0 Kudos
Frequent Contributor II

It looks like you are trying to use 4x syntax in a 3x app. The FeatureLayer API in 3x is slightly different. You can just pass the URL.

If you have the itemId, you can get the item and get the URL off of that

0 Kudos