Fails to import data to salesforce

  • 31Views
  • Last Post 06 March 2018
0
votes
Amit Bareket posted this 05 March 2018

Hi there,

I set up the connection from MySQL to SalesForce. My account is amit@safervpn.com.

When we click the Run data import job it fails with error message but there is no logs. How can we understand what is the error?

Thanks,

Amit

Order By: Standard | Newest | Votes
0
votes
Mariia Zaharova posted this 05 March 2018

We have checked detailed logs for your package, the following error occurs while running it:

(License__c) description: Cannot convert the expression result data type "DT_I4" to the column data type "DT_NTEXT". The result of the expression should be written to an input/output column, but the data type of the expression cannot be converted to the data type of the column.

 

Most likely, the issue is related to the expression mapping that is set for the "License_Type__c" field:

   "target": "License_Type__c",

    "source": {"expression": "packageid"}

 

For cases when it is necessary map columns with the different data types, Expression mapping should be used in this format:

(DT_I4)[string_field]

(DT_WSTR, 10)[int_field]

 

Thus, if your "License_Type__c" field is of string data type and "packageid" column is of int data type, you should use this Expression:

(DT_WSTR, 10)packageid

where 10 is the length of the string (use the corresponding to your scenario value here).

 

Please tell us if this helps.

0
votes
Amit Bareket posted this 05 March 2018

Great thanks it worked.

 

Howcan we set up a field to empty if equals to "0000-00-00" and the field value otherwise?

 

I couldn't find an example for If statement within an expression

0
votes
Mariia Zaharova posted this 05 March 2018

Such statements can be written in the following way:

  • boolean_expression ? value_if_true : value_if_false
  • your_field == "0000-00-00" ? "": your_field 

 

We use SSIS expression syntax for Expression mapping, so you may additionally study Microsoft's documentation: https://docs.microsoft.com/en-us/sql/integration-services/expressions/conditional-ssis-expression

 

0
votes
Amit Bareket posted this 05 March 2018

Thanks for this! Quick question -- We managed to get it running but on the Contacts sync we get the following error:

You're creating a duplicate record. We recommend you use an existing record instead.;"0010Y00001DWBG7QAP";"TORMENA";"Sylvain";"+33170955900";"sylvain.tormena@teads.tv";"1775852"

Do you know why it happens? We don't have any duplicated record on Salesforce

0
votes
Mariia Zaharova posted this 06 March 2018

You are using UPSERT operation by an External ID field (Salesforce's native support for UPSERT). Please refer to:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_upsert.htm

https://developer.salesforce.com/forums/?id=906F00000008xcZIAQ

"If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated."

 

Most likely, key is not unique and finds several records by ExternalId value and, thus, such an error occurs. Or, for example, no record were found by ExternalId value and two records are inserted with the same unique fields (e.g. ExternalId and LastName) within one batch and update for the second record does not occur. This behaviour is related to Salesforce's UPSERT implementation.

Close