Select to view content in your preferred language

Issues with publishing and overwriting web layers using modelbuilder

5028
16
Jump to solution
08-26-2021 08:23 AM
JD1016
by
Frequent Contributor

Hello Everyone,

I'm currently using ArcGIS Pro 2.8.2.  I happened upon a script that was graciously shared by Jonah Lay to publish and overwrite web layers in Modelbuilder (see JonahLayCode.txt).  I followed the directions for adding the script, creating the script tool, and adding to an existing model.  The directional post from Jonah can be found here: https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/publish-and-overwrite-web-layers-in-mod...

I've attached a screenshot that illustrates my model with the Publish Web Feature Layer section added (see AutoPublishOutagesScreenshot.png).

In running the model as it is illustrated in the above screenshot, I received the following error messages (see AutoPublishOutagesFailureScreenshot.png).

I am not a programmer.  That we just establish. To that end, can someone please offer some kernels of wisdom on how I may succeed in using this script successfully given the errors I have encountered?  I'm sure it is something that I have not done properly given the indicated messages.

Thank you one and all in advance.

JD

0 Kudos
16 Replies
JonahLay
Esri Contributor

It sounds like publishing is now successful but overwriting isn't? If so, double-check that the web layer name matches the existing web layer name and the Overwrite Existing Web Layer check box is checked.

 

JD1016
by
Frequent Contributor

Hi Jonah,

Yes.  Publishing ran successfully without any issues.  I double checked the parameters of the Publish Web Feature Layer component and everything looks fine and matches (see SDDFile Location. png).  I circled the Output Directory portion of the Publish Web Feature Layer screenshot because I think something might be happening here.  After running the model, I checked and indeed the YukonOutageLocsAGOWMPro hosted feature layer displayed an updated date but contained no data.  Also peculiar is that the corresponding Service Definition file, located in the same folder as my YukonOutageLocsAGOWMPro hosted feature layer, was not updated.  However, a new Service Definition file was created and placed in my root default directory in AGO with the same name as my hosted feature layer.  Could there be a some conflict going on between the two service definition files?  In addition, am I storing the SDDFiles correctly in the Output Directory section of the Publish Web Feature Layer parameters section?

Thanks.

Jeff

0 Kudos
JonahLay
Esri Contributor

Thanks for confirming, Jeff.

Did you change the output directory after publishing and before overwriting? Does overwriting work if the output directory is a local folder like on your C drive instead of a network folder?

Jonah

0 Kudos
JD1016
by
Frequent Contributor

Hi Jonah,

I'm not sure about the order of change for the output directory but I did perform two scenarios to see if there was any difference in the workflow.  I first performed a standard Publish Web Layer for the YukonOutageLocsAGOWMPro layer out of Pro and placed it within a folder I created on AGO entitled "Yukon Outage".  Both the hosted feature layer and corresponding source definition file were successfully published.  I then ran the modelbuilder script to update this hosted feature layer and source definition file.  The update ran successfully, the data was indeed updated in this AGO folder and the point locations can be added to a map in AGO without issue.  However, the only caveat was that it also produced a source definition file and saved it to my root AGO directory file.  I did experiment with changing the Publish Web Feature Layer parameters by redirecting the Output Directory path to my C:\ drive but this did not change the end result.  I guess the question is, which is the valid source definition file?

Thanks.

Jeff

0 Kudos
JonahLay
Esri Contributor

Hi Jeff,

I believe you are seeing this behavior because your script tool hasn't been modified to include the portalFolder property. The Next Steps section in the blog covers how to do this.

Hope it helps,

Jonah

JD1016
by
Frequent Contributor

Hi Jonah,

That did it!  Thank you so much for all your help.  This script will help us immensely.

Jeff

0 Kudos
JonahLay
Esri Contributor

Glad to hear. You're welcome!

0 Kudos