<OrgLocationsImport> fails with "A location/job with the name and path already exists"

114 Views Asked by At

I want to update a job on an organizational map with the Kronos Workforce Central v8.1 XML API.

According to the Workforce Timekeeping v8.1 Developer's Toolkit Guide, sending a request with <OrgLocationsImport> and Action="Update" should update a job if it already exists. However, while I can import new jobs without issue, the request will fail if I try to update an existing job.

Error Message:

WFP-00335 A location/job with the name TEST and path "ROOT/BU/DIV/SL/DEPT/TEST" already exists from 6/02/2010 to 12/31/2999.

XML Request:

<Kronos_WFC version="1.0">
    <Request Action="Update">
        <OrgLocationsImport ChangeDate="05/30/2018">
            <OrgLocations>
                <OrgLocation
                  ParentLocationPathName="ROOT/BU/DIV/SL/DEPT"
                  LocationName="TEST"
                  LocationType="Job"
                  Description="Test Job">
                </OrgLocation>
            </OrgLocations>
        </OrgLocationsImport>
    </Request>
</Kronos_WFC>

XML Response:

<Kronos_WFC TimeStamp="5/30/2018 10:18AM GMT-04:00" version="1.0" WFCVersion="8.1.1.569">
    <Response Status="Failure" Action="Update">
        <Error Message="WFP-00335 A location/job with the name TEST and path
            &quot;ROOT/BU/DIV/SL/DEPT/TEST&quot; already exists from 6/02/2010
            to 12/31/2999." ErrorCode="106" AtIndex="0">
            <ErrorData>"PATH=ROOT/BU/DIV/SL/DEPT/TEST""EFFECTIVE_DATE=6/02/2010"
                "EXPIRATION_DATE=12/31/2999""NAME=TEST"
            </ErrorData>
        </Error>
    </Response>
</Kronos_WFC>

Why does my <OrgLocationsImport> update request fail if the location already exists?

1

There are 1 best solutions below

0
Stevoisiak On BEST ANSWER

You need to specify the LocationPathName when updating an <OrgLocation>.

<Kronos_WFC version="1.0">
    <Request Action="Update">
        <OrgLocationsImport ChangeDate="05/30/2018">
            <OrgLocations>
                <OrgLocation
                  ParentLocationPathName="ROOT/BU/DIV/SL/DEPT"
                  LocationPathName="ROOT/BU/DIV/SL/DEPT/TEST"
                  LocationName="TEST"
                  LocationType="Job"
                  Description="Test Job">
                </OrgLocation>
            </OrgLocations>
        </OrgLocationsImport>
    </Request>
</Kronos_WFC>

According to the WFC documentation, an <OrgLocation> should always include either a LocationPathName or a LocationNum. Excluding them should be considered undefined behavior.

Interestingly, when these attributes are excluded from an <OrgLocationsImport> request in WFC v6.3 and v8.1, the request seems to act as a makeshift AddOnly action. However, this behavior may change in future versions of Workforce Central.