mule中的Datamapper和Salesforce Connector

时间:2014-07-05 17:45:20

标签: salesforce mule datamapper mule-studio

我试图将数据从数据库映射到mule中的salesforce,这是在Salesforce Connector中使用CreateBulk选项                                                                             - >                             

<flow name="datamapperFlow1" doc:name="datamapperFlow1">
    <poll doc:name="Poll">
        <fixed-frequency-scheduler frequency="30" timeUnit="SECONDS"/>
        <db:select config-ref="Generic_Database_Configuration" doc:name="Database">
            <db:parameterized-query><![CDATA[select * from Persons1]]></db:parameterized-query>
        </db:select>
    </poll>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
    <foreach doc:name="For Each">
        <data-mapper:transform config-ref="Map_To_HRISASI__c" doc:name="Map To HRISASI__c"/>
    </foreach>
    <sfdc:create-bulk config-ref="Salesforce" type="HRISASI__c" doc:name="Salesforce">
        <sfdc:objects ref="#[payload]"/>
    </sfdc:create-bulk>
    <logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>

创建批处理作业,但记录无法插入,销售人员中出现以下错误

<result>
<errors>
<fields>PHONE</fields>
<fields>EMPNAME</fields>
<fields>EMPLOYEEID</fields>
<message>
HRISASI__c: bad field names on insert/update call: PHONE, EMPNAME, EMPLOYEEID
</message>
<statusCode>INVALID_FIELD_FOR_INSERT_UPDATE</statusCode>
</errors>
<success>false</success>
<created>false</created>
</result>

我的Data Mapper脚本如下所示

//MEL
//START -> DO NOT REMOVE
output.__id = input.__id;
//END -> DO NOT REMOVE
output.EmployeeId__c = input.EmpId;
output.EmpName__c = input.Empname;
output.Phone__c = input.Phone;

有人可以告诉我错误的原因是什么

提前谢谢

1 个答案:

答案 0 :(得分:0)

问题是因为在每个内部使用datamapper。 foreach之外的有效负载不包含映射,因此在尝试将数据映射到salesforce时会引发错误