在 Microsoft Dynamics 365 中匯入 AttributeMap 時發生錯誤

本文提供在 Microsoft Dynamics 365 中匯入 AttributeMap 時所發生錯誤的解決方案。

適用於:Microsoft Dynamics 365 Customer Engagement Online
原始 KB 編號: 4494576

徵狀

試著在 Dynamics 365 中匯入解決方案時,您會收到下列錯誤:

「匯入解決方案:[解決方案名稱] 失敗。
錯誤碼 8004f016”

錯誤對話框內的方格包含 Type = Mappings 的數據列。 針對此資料列顯示的詳細資料文字如下:

「受控解決方案無法覆寫目標系統上具有 Unmanaged 基底實例的 AttributeMap 元件。 此錯誤最可能的案例是 Unmanaged 解決方案已在目標系統上安裝新的 Unmanaged AttributeMap 元件,而來自相同發行者的受控解決方案現在嘗試安裝與 Managed 相同的 AttributeMap 元件。 這會導致目標系統上的解決方案分層無效,且不允許。」

下載 XML 記錄檔,並在 Excel 中開啟。 在 [ 元件] 索引 標籤中,找出儲存格:0x8004F016。

在下一個資料行中,將會是包含元件識別碼的錯誤訊息:

「受控解決方案無法覆寫具有 Unmanaged 基底實例的 Id= [元件識別符] 的 AttributeMap 元件。 此錯誤最可能的案例是 Unmanaged 解決方案已在目標系統上安裝新的 Unmanaged AttributeMap 元件,而來自相同發行者的受控解決方案現在嘗試安裝與 Managed 相同的 AttributeMap 元件。 這會導致目標系統上的解決方案分層無效,且不允許。」

原因

如錯誤詳細數據中所述,此錯誤最可能的案例是已在目標組織中的默認解決方案上進行非受控自定義。 這會導致目標系統上的解決方案分層無效,且不允許。

範例:您的 Dynamics 365 實例已經有元件,例如透過編輯默認解決方案所建立的自定義 AttributeMap。 如果您稍後嘗試將具有相同 AttributeMap (元件的解決方案匯入) 為受控解決方案,您將會收到此錯誤。

解決方案

針對 AttributeMap,您可以使用兩個 Web API 查詢來找到 Managed 元件,然後在目標中刪除:

  1. 開啟您組織的瀏覽器,然後複製索引標籤。

  2. [GUID from Error]將 取代為記錄檔中錯誤訊息的 GUID,然後附加至您的組織:

    api/data/v9.1/attributemaps([GUID from Error])?$select=_entitymapid_value,sourceattributename, targetattributename

    例如:
    https://MyOrganization.crm11.dynamics.com/api/data/v9.1/attributemaps(0a7bb84f-3d3c-e911-a977-0022480187f0)?$select=_entitymapid_value,sourceattributename,targetattributename

    輸出如下:

    {
    "@odata.context": "https://MyOrganization.crm11.dynamics.com/api/data/v9.1/$metadata#attributemaps(_entitymapid_value,sourceattributename,targetattributename)/$entity",
    "@odata.etag": "W/"5299006"",
    "_entitymapid_value": "1172d7cc-3c3c-e911-a977-0022480187f0",
    "sourceattributename": "css_mapfieldparent",
    "targetattributename": "css_mapfieldchild",
    "attributemapid": "0a7bb84f-3d3c-e911-a977-0022480187f0",
    "_organizationid_value": "112f329f-0a5f-4e2c-a2f0-c54e4824faa9"
    }
    
  3. [_entitymapid_value]將 取代為第一個查詢中的值,然後附加您的組織:

    api/data/v9.1/entitymaps([_entitymapid_value])?select=sourceentityname,targetentityname

    例如:
    https://MyOrganization.crm11.dynamics.com/api/data/v9.1/api/data/v9.1/entitymaps(1172d7cc-3c3c-e911-a977-0022480187f0)?select=sourceentityname,targetentityname

    輸出如下:

    {
    "@odata.context": "https://emeacrm3.crm11.dynamics.com/api/data/v9.1/$metadata#entitymaps(sourceentityname,targetentityname)/$entity",
    "@odata.etag": "W/"5296276"",
    "sourceentityname": "css_testamparent",
    "targetentityname": "css_testamchild",
    "entitymapid": "1172d7cc-3c3c-e911-a977-0022480187f0",
    "_organizationid_value": "112f329f-0a5f-4e2c-a2f0-c54e4824faa9"
    }
    
  4. 使用從兩個查詢擷取的資訊來識別 AttributeMap:

    sourceentityname: css_testamparent,
    sourceattributename: css_mapfieldparent,
    targetentityname: css_testamchild,
    targetattributename: css_mapfieldchild,

  5. 沒有 ,AttributeMap 就無法存在 1:N relationship。 在目標組織中尋找下列範例:

    1:N 來自 [sourceentityname] ->[targetentityname] 的關聯性,以字段 [sourceattributename] ->[targetattributename] 為基礎

  6. 流覽至 [ 設定]、[ 自定義]、[ 自定義系統],以在目標組織中找出此元件。

  7. 選取 [實體],然後選取 [sourceentityname]

  8. 取 [1:N 關聯性]

  9. 相關實體 排序,並開啟 [targetentityname] 的關聯性。

  10. 左側的 [對應]。

  11. 使用下列項目移除對應:

    來源名稱:[sourceattributename]
    目標名稱:[targetattributename]

  12. 再次嘗試匯入您的解決方案。