Select to view content in your preferred language

CreateWebLayerSDDraft doesn't include Date Field configuration?

2151
6
Jump to solution
07-05-2019 10:57 AM
SeanLawrence
Occasional Contributor

So I'm having an issue where I'm trying to automate publishing a feature service to AGO using python where it's failing at the analyze during StageService_server ([{"code":"00129","message":"Map has layers that record Editor Tracking dates in database time zone, but time zone has not been defined","object":"Map"}]).

               
The layers successfully publish using ArcGIS Pro 2.4 when setting the Date Field configuration to the appropriate time zone (as I'm using database time).

I'm assuming there is no Date Field configuration with CreateWebLayerSDDraft as it's not in the documentation.  Am I missing something?  Is there a work around that anyone knows about?

I'm messing around with the sddraft configuration and setting

<PropertySetProperty xsi:type='typens:PropertySetProperty'><Key>hasEditorTrackingDatesInDbTimezone</Key><Value xsi:type='xs:string'>true</Value></PropertySetProperty>

Doesn't seem to help

1 Solution

Accepted Solutions
ScottMoore__Olympia_
Esri Contributor

I would look at dateFieldsTimeReference for use with the publish_parameters option.  It would look something like this in code:

from arcgis.gis import GIS
sd_itemid = "a71a0a30cd0e4cde9d196f99e935a919"
gis = GIS("https://www.arcgis.com", "YourAGOLUserName")

#Find SD file, then update or add, then publish
sd_item = gis.content.get(sd_itemid)

#Parameters for editor tracking
pub_params = {"dateFieldsTimeReference" : {"timeZone":"Pacific Standard Time"}}

sd_item.publish(publish_parameters=pub_params, overwrite=True)

More of the doc can be found here:

https://developers.arcgis.com/rest/users-groups-and-items/publish-item.htm

View solution in original post

6 Replies
ScottMoore__Olympia_
Esri Contributor

I would look at dateFieldsTimeReference for use with the publish_parameters option.  It would look something like this in code:

from arcgis.gis import GIS
sd_itemid = "a71a0a30cd0e4cde9d196f99e935a919"
gis = GIS("https://www.arcgis.com", "YourAGOLUserName")

#Find SD file, then update or add, then publish
sd_item = gis.content.get(sd_itemid)

#Parameters for editor tracking
pub_params = {"dateFieldsTimeReference" : {"timeZone":"Pacific Standard Time"}}

sd_item.publish(publish_parameters=pub_params, overwrite=True)

More of the doc can be found here:

https://developers.arcgis.com/rest/users-groups-and-items/publish-item.htm

NataliyaLys
Frequent Contributor

Scott Moore (Olympia)‌ thank you for posting this. I was able to add it to my script, and update the time zone.

ScottMoore__Olympia_
Esri Contributor

Sean Lawrence‌ Does this answer this question?

0 Kudos
SaraJK
by
Frequent Contributor

Will this work for a file GDB? I added this parameter and got the error:

"User cant overwrite this service, using this data, as this data is already referring to another service.
(Error Code: 500)"

This GDB is only being used in one service.

0 Kudos
ScottMoore__Olympia_
Esri Contributor

I only tested with a service definition file, not a file geodatabase.  It does look like it should work from a file geodatabase based on the API ref:

arcgis.gis module — arcgis 1.8.2 documentation 

From the error, it appears that the feature service has already been published from the file geodatabase.  You could delete the feature service (keep the file geodatabase item) and try it (make sure you have backed up the feature service if there have been changes to it that you want to keep).  The sd_itemid would point to an item of type "File Geodatabase" that hasn't yet had a feature service published from it.

0 Kudos
JamieWhite
New Contributor

Hi Scott,

Thank you for posting this solution, and I know it is now three years later, but this no longer works per the documentation. Per the Developers Page you cannot combine a publish parameters with an overwrite

JamieWhite_0-1678317273015.png

Do you have any other thoughts on how to set the Time Zone for your service you are trying to overwrite.

 

0 Kudos