在 salesforce 中插入查找类型记录时遇到问题:mule esb

Facing issue while inserting lookup type record in salesforce: mule esb

我在 salesforce 中插入记录时遇到问题。 记录类型为查找(帐户),字段名称为 site_id.I 将 csv 文件记录插入 salesforce。但是由于这个记录(数据类型(查找)),我无法在 salesforce 中插入记录。如果我将记录类型更改为文本而不是我可以插入。但我需要 lookup(Account) 类型。 怎么可能...请帮帮我

以下是我的流程

<batch:job name="testsalesforceBatch1">
        <batch:input>
            <file:inbound-endpoint path="CustomFile" responseTimeout="10000" doc:name="File"/>
            <data-mapper:transform config-ref="CSV_To_List_Report__c__1" doc:name="CSV To List&lt;Report__c&gt;"/>
        </batch:input>
        <batch:process-records>
            <batch:step name="Batch_Step">
                <batch:commit size="1000" doc:name="Batch Commit">
                    <sfdc:create-bulk config-ref="Salesforce" type="Report__c" doc:name="Salesforce">
                        <sfdc:objects ref="#[payload]"/>
                    </sfdc:create-bulk>
                </batch:commit>
            </batch:step>
        </batch:process-records>
        <batch:on-complete>
            <logger message="#[payload.totalRecords]" level="INFO" doc:name="Logger"/>
        </batch:on-complete>
    </batch:job>

我收到以下错误...

 [SaveResult  errors='{[1][Error  fields='{XXXXXXX,}'
 message='XXXXXX: id value of incorrect type: 000'
 statusCode='MALFORMED_ID'
]

注意:000 值在帐户 table

中可用

我得到了答案..如何通过 mule 在 salesforce 中插入查找数据类型记录。 使用 recordId 存储该值...

谢谢

对于 Salesforce 集成,insert/upsert/create 具有查找值的字段有两种方法。

方式一:使用查找目标的实际ID。因此,如果您要查找一个帐户,您首先需要获取您定位的帐户的 ID,然后在字段中使用该 ID 作为数据映射器中的 "String"。

方式 2:在帐户上使用外部 ID 并更新引用外部 ID 的新记录。这有点复杂,但是是不必进行两次 API 调用的非常好的方法。 然后在 Datamapper 中,您需要将帐户列为元素而不是属性。这必须手动完成,因为 Datamapper 不知道自己要这样做。

Account (Element)
|-type (String)  -> 'Account'  *this is just a fixed string*
|-ExternalIdFieldName__c (String) -> external_id_from_datasource

由于 Account 是一个标准的 SalesForce 对象,它后面没有 __c 或 __r,如果它是一个自定义对象并且您正在查找它,它会发生一些变化。

对象:

MyCustomAccount__c
External ID in above: AccountExternalId__c
Lookup field:  AccountLookup__c  (lookup to Account from Contact)

在 Datamapper 中,您有:

AccountLookup__r  (Element)  *notice the __r instead of __c*
|- type (String) -> 'MyCustomAccount__c'  *this is just a fixed string*
|- AccountExternalId__c (String) -> externalidfieldfromcsv