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

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

我想使用 Kronos Workforce Central v8.1 在组织地图上更新工作 XML API。

根据 Workforce Timekeeping v8.1 Developer's Toolkit Guide,发送带有 <OrgLocationsImport>Action="Update" 的请求应该更新已存在的作业。但是,虽然我可以毫无问题地导入新工作,但如果我尝试更新现有工作,请求将会失败。

错误信息:

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请求:

<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 响应:

<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>

如果位置已经存在,为什么我的 <OrgLocationsImport> 更新请求会失败?

您需要在更新 <OrgLocation> 时指定 LocationPathName

<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>

根据 WFC 文档,<OrgLocation> 应始终包含 LocationPathNameLocationNum。排除它们应被视为未定义的行为。

有趣的是,当这些属性从 WFC v6.3 和 v8.1 中的 <OrgLocationsImport> 请求中排除时,该请求似乎充当临时 AddOnly 操作。但是,此行为可能会在 Workforce Central 的未来版本中发生变化。