0

enter image description hereI am currently working on a Azure Data Factory Mapping.

SQL Server to CRM

There is a Entity Reference look up field that I am trying to update. Do not know how to. The field is: new_districtlink --> Territory/Territories

using JSON we use:
{\"new_districtlink@odata.bind\":\"/territories(c8a29516-4001-e311-98f3-78e3b5089b9d)\"}"

Don't know how to reference this field in AZURE DATA FACTORY so it updates correctly. Currently I have tried Mapping using newdistrictlink@EntityReference

I get the following error:

"errorCode": "2200", "message": "Failure happened on 'Sink' side. ErrorCode=UserErrorDynamicsOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Dynamics operation failed with error code: -2147220891, error message: The real-time workflow named "ACCOUNT: Pull in Region and Division from District(Territory)" failed with the error "For a Vendor Account Type, select 199 as the district.".,Source=Microsoft.DataTransfer.ClientLibrary.DynamicsPlugin,''Type=System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]],Message=The creator of this fault did not specify a Reason.,Source=Microsoft.DataTransfer.ClientLibrary.DynamicsPlugin,'", "failureType": "UserError", "target": "CMA CRM VENDOR", "details": [] }

The error I am getting is in Azure Data Factory. The JSON was just an example of how we are doing it in C# currently.

I am setting District as GUID and Mapping District to new_districtlink@EntityReference.

SELECT
ACCOUNTID,
'2EC67250-E3C4-E311-ABE1-6C3BE5BDA9AC' AS DISTRICT
FROM [dbo].[VendVendorV2Staging]
WHERE ADDRESSLOCATIONROLES = 'Business';
ahsatan
  • 61
  • 1
  • 1
  • 7

1 Answers1

0

I see there’s no issue with Json payload you used, it is correct to map an EntityReference (lookup).

I guess this is data validation message coming back from CRM Real time workflow which is validating the territory (district) against the created account type.

The error message clearly says - the value you passed (guid in district link Json payload for territory) is not expected value based on business logic validation in real time workflow. For vendor type account, 199 is the expected district and find out the guid of that territory record and update the Json.

Or change the account type to something else than vendor. Then it should work, or check with CRM dev team or BA for business rules before implementing and testing ADF integration for creating the account record.

Arun Vinoth
  • 20,360
  • 14
  • 48
  • 135
  • The error I am getting is in Azure Data Factory. The JSON was just an example of how we are doing it in C# currently. I am setting District as GUID and Mapping District to new_districtlink@EntityReference. SELECT ACCOUNTID, '2EC67250-E3C4-E311-ABE1-6C3BE5BDA9AC' AS DISTRICT FROM [dbo].[VendVendorV2Staging] WHERE ADDRESSLOCATIONROLES = 'Business'; – ahsatan Sep 14 '20 at 02:47
  • @ahsatan I’m not sure how this sql query is related to the error message in question. Can you investigate in the direction - if there’s any entity level business rule or workflow throwing error back to source which is ADF here – Arun Vinoth Sep 14 '20 at 02:51
  • In ADF, copy data pipeline, I am using SQL as the source to set values. I set the GUID to District and then in the mapping section, I map that to new_districtlink@EntityReference field. I have added an image to the original post. – ahsatan Sep 14 '20 at 03:27
  • @ahsatan in your other question, I saw ‘199 - Corporate’ district has guid ‘f975-xxx...’ are you setting the same value here? – Arun Vinoth Sep 14 '20 at 03:31
  • Updated the value. – ahsatan Sep 14 '20 at 03:33
  • @ahsatan sorry, not following you. what is updated and where is it updated ? – Arun Vinoth Sep 16 '20 at 03:46