0
votes

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:
{\"[email protected]\":\"/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';
1

1 Answers

0
votes

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.