0

我有一个需要从Salesforce对象中删除完整数据的场景。

为了实现,首先,从该对象中获取所有 Id 并将其保存在 .csv 格式的文件中。数据上传到文件后,需要使用批量删除记录。

我能够查询对象并将数据保存在 .csv 中,但在删除数据时有时会出现错误。

 Message               : null (java.nio.BufferUnderflowException).
    Element               : /batch-delete-genericFlow/processors/3 @ apl-sfa-batch-interface-v44:batch-delete-all.xml:48 (Transform Message)
    --------------------------------------------------------------------------------
    Exception stack is:
    null (java.nio.BufferUnderflowException). (org.mule.api.MessagingException)
      java.nio.Buffer.nextGetIndex(Buffer.java:500)
      java.nio.HeapCharBuffer.get(HeapCharBuffer.java:135)
      com.mulesoft.weave.reader.UTF8StreamSourceReader.decode$1(SeekableStreamSourceReader.scala:147)
      com.mulesoft.weave.reader.UTF8StreamSourceReader.read(SeekableStreamSourceReader.scala:167)
      com.mulesoft.weave.reader.csv.parser.StreamingCSVParser.read(StreamingCSVParser.scala:61)
      (66 more...)

      (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

PFB 删除批号代码:

    <batch:job name="batch-delete-genericBatch" max-failed-records="-1">
        <batch:input>
            <enricher target="#[flowVars['jobInfo_delete']]" doc:name="Enricher jobId">
                <sfdc:create-job config-ref="SFA_MSBI" type="#[flowVars.sObjectName]" concurrencyMode="Serial" contentType="CSV" operation="delete" doc:name="Create Job"/>
            </enricher>
            <expression-component doc:name="Save Job ID"><![CDATA[sessionVars.jobInfo_delete = flowVars.jobInfo_delete.id
]]></expression-component>
        </batch:input>
        <batch:process-records>
            <batch:step name="Batch_Step" >
                <batch:commit  doc:name="Batch Commit" size="5000">
                    <processor-chain doc:name="Processor Chain">
                        <dw:transform-message metadata:id="df884737f2bc" doc:name="Transform Message">
                            <dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
payload map {
    Id: $.Id
}]]></dw:set-payload>
                        </dw:transform-message>
                        <sfdc:create-batch config-ref="SFA_MSBI" doc:name="Salesforce">
                            <sfdc:job-info ref="#[flowVars.jobInfo_delete]"/>
                            <sfdc:objects ref="#[payload]"/>
                        </sfdc:create-batch>
                    </processor-chain>
                </batch:commit>
            </batch:step>
        </batch:process-records>
        <batch:on-complete>
            <async doc:name="Async">
                <sfdc:close-job config-ref="SFA_MSBI" jobId="#[sessionVars.jobInfo_delete]" doc:name="Salesforce"/>
            </async>

        </batch:on-complete>
    </batch:job>

请指教。

4

1 回答 1

0

似乎错误导致了一些价值。请发布更多代码以获得一些上下文。同时,以下是删除 SFO 的正确方法。

<sfdc:delete config-ref="mySalesforceConfig">
    <sfdc:ids>
        <sfdc:id>001...</sfdc:id>
    </sfdc:ids>
</sfdc:delete>

http://mulesoft.github.io/salesforce-connector/8.3.1/apidocs/apidoc.html#_delete

于 2017-08-29T08:37:34.447 回答