Copy Activity to Salesforce Sink failure when updating a field referenced through a lookup relationship

Salman Anza 0 Reputation points
2023-10-05T16:20:01.3333333+00:00

Hello All,

I have a Copy Activity defined whose source is a CSV and target is a custom Salesforce sObject.

As part of the mapping, I need to update a custom field on the standard Account sObject, which is referenced by the custom sObject through a lookup relationship field.

The Relevant Schemas for the two sObjects are: sinkCustomSalesforceObj.Lookup_Relationship_to_Account__r, Account.ID_In_Account__c

My first thought is to reference the field through the lookup relation field:

{
    "inputs": [
        {
            "referenceName": "sourceCSV",
            "type": "DatasetReference"
        }
    ],
    "outputs": [
        {
            "referenceName": "sinkCustomSalesforceObj",
            "type": "DatasetReference"
        }
    ],
	"typeProperties": {
        "source": {
            "type": "DelimitedTextSource",
            "storeSettings": {
                "type": "SftpReadSettings",
                "recursive": true,
                "enablePartitionDiscovery": false,
                "disableChunking": false
            },
            "formatSettings": {
                "type": "DelimitedTextReadSettings"
            }
        },
        "sink": {
            "type": "SalesforceSink",
            "writeBatchSize": 5000,
            "writeBehavior": "upsert",
            "externalIdFieldName": "external_Id__c", //i.e. sinkCustomSalesforceObj.external_Id__c
            "ignoreNullValues": false
        },
        "enableStaging": false,
        "translator": {
            "type": "TabularTranslator",
            "mappings": [
				...,
                {
                    "source": {
                        "name": "ColumnFromCSV"
                    },
                    "sink": {
                        "name": "Look_Up__r.ID_In_Account__c"
                    }
                }
            ],
            "typeConversion": true,
            "typeConversionSettings": {
                "allowDataTruncation": true,
                "treatBooleanAsNumber": false
            }
        }
    }
}

However, this results in the following error:

ErrorCode=SalesforceOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Salesforce Operation Failed: INVALID_FIELD:Foreign key external ID: 12345678 not found for field ID_In_Account__c in entity Account:--,Source=Microsoft.DataTransfer.Runtime.SalesforceConnector,'

The Salesforce specific docs doe not mention how to deal with this issue.

Does anyone have any suggestions?

Regards

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,873 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Salman Anza 0 Reputation points
    2023-10-19T21:45:52.4133333+00:00

    I will create a support ticket with MS


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.