Clone WITHIN organization?

638
3
04-08-2022 08:50 AM
GIS_utahDEM
Occasional Contributor II

Hello!

I have a dashboard that I would like to clone for each county in my state. I have already used the api for python to create view layers and map copies with the new view layer for each county, but I'm getting stuck on cloning the dashboard. I thought I might be able to clone it using .clone_items within my organization, but now I'm thinking that's not possible since I can only find documentation on cloning between organizations. I should mention I'm asking this because my code runs without errors, but doesn't appear to be doing anything in my AGOL (I've tried using the same gis for source and target, as well as two different accounts in the same organization).

I'm definitely open to other options, but the tricky part is the item_mapping, because I want obviously the web map to be pointing at the one for the correct county, but also I have a host of other widgets interacting with the layers that I want to be mapped to the view layer in the map instead of the original layer. My thought is I'll probably have to go into the JSON dictionary and replace some IDs with variables, but given my lack of experience with those I was hoping to use a more out-of-the-box solution (cloning).

I could potentially do this manually for the 29 counties, but down the line I will need to have this automated as I will need to follow the same process for all the counties AND municipalities (almost 300). 

Code is attached in ZIP file and in screenshots. 

GIS_utahDEM_0-1649432792660.png

GIS_utahDEM_1-1649432822688.pngGIS_utahDEM_2-1649432867750.png

GIS_utahDEM_3-1649432904744.pngGIS_utahDEM_4-1649432937510.png

 

0 Kudos
3 Replies
GeoJosh
Esri Regular Contributor

Hello! I just ran a quick test cloning a simple dashboard in my ArcGIS Online organization and it worked as I would expected it to. It cloned the Dashboard, along with the dependencies (web map and feature layer).

GeoJosh_0-1649436203965.png

When the clone_items function finishes, it spits out a list of items that were successfully copied. Do you see this list? If not, I suggest taking clone_items out of the for loop and see if you can isolate the issue down to a single item/Dashboard.

Also, are you using API version 2.0.0?

0 Kudos
GIS_utahDEM
Occasional Contributor II

@GeoJosh Thanks for the reply! I have arcgis version 1.8.3.

I think the issue is with the item mapping -- this is what I get outside of the for loop (empty list/no new dashboard):

GIS_utahDEM_0-1649686605764.png

 

 

0 Kudos
GIS_utahDEM
Occasional Contributor II

@GeoJosh I think there is a bug/error with the function. After some testing, here is what I've found:

1. I saved a copy of my web map, and was able to successfully clone it. 

2. I added the cloned web map to a new basic dashboard with an embedd and a list, I was able to successfully clone the dashboard

3. I added a web mapping dictionary to change the dashboard web-map to another slightly different copy of the web map. The clone_items returned an empty list.

4. I removed the web_mapping and tried to clone the dashboard again, exactly the same as I did in step 2. The clone_items returned an empty list. 

5. I re-ran a previously successful clone of the web map, it returned an empty list.

6. I added a new feature layer to the web map that was in the dashboard, then ran the clone_items for the dashboard. Only the new feature layer was cloned.

It seems that trying to map different items to the dashboard breaks the ability of the dashboard or it's contents to be cloned. The only thing I can think of other than a bug is some default setting that prevents item_mapping?? Appreciate any insights you have!

0 Kudos