Creating Embedded content linked to survey123 form through ArcGIS REST or Python API

417
1
04-10-2023 07:23 AM
Labels (2)
mattkramer
Occasional Contributor

Copying my post from the Dashboard community to here:

Hello, I am trying to create a dashboard from scratch using just the API. I need this dashboard to have an embedded content that links a layer in a map to a survey form that can be selected from a list. So far, we have been able to create all the elements we need to (Map, List, Survey123 Embedded content) but we have been having trouble getting the Embedded Content to use the globalID of the feature layer to filter the survey results. From looking at the item link of some existing dashboards, I have found that these embedded content elements have a "datasets" property that seems to contain the definition of the element that controls this functionality, here is that snip:

"datasets": [
        {
          "type": "serviceDataset",
          "name": "main",
          "dataSource": {
            "type": "layerDataSource",
            "layerId": "1873e4024fb-layer-3",
            "ownerId": "676b5e65-a26c-4c06-ad74-b9c80607c802"
          },
          "groupByFields": [],
          "orderByFields": [],
          "statisticDefinitions": [],
          "maxFeatures": 1,
          "clientSideStatistics": false,
          "outFields": [
            "*"
          ],
          "returnDistinctValues": false,
          "allowDownload": false
        }
      ],
      "type": "embeddedContentWidget",

 

Also included the "type" field just for context. Is there any way to edit this datasets property through script? The whole dashboard is being created from scratch so the ids of the elements should be able to be accessed without too much trouble. If this is able to be changed, how would we go about finding the "layerId" field as well? That does not look like something I have seen before.

 

Thanks,

0 Kudos
1 Reply
Kepa
by Esri Contributor
Esri Contributor

Hello @mattkramer,

You should be able to edit the definition data of the dashboard using the update method from the item object. However that layerId property (if I'm not mistaken) is random and is createad every time a user adds an element into the dashboard with the GUI. It's like an internal unique ID to perform all the links, actions, triggers, etc. with the rest of elements that take part on the dashboard and it should never changed unless some user modifies it on purpose.

Cheers,

0 Kudos