I have a scenario where I need to delete complete data from a Salesforce
object.
TO achieve, first, all the Ids from that object are fetched and saved in a file in .csv format. Once the data is uploaded into the file, need to delete the record by records in using batch.
I'm able to query on the object and save the data in .csv but while deleting the data sometimes getting below error.
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 delete Batch code Code:
<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>
Please advise.
Seems like Error is causing with some Value. Please post more code to have some context. In mean time following is a proper way of deleting SFOs.
http://mulesoft.github.io/salesforce-connector/8.3.1/apidocs/apidoc.html#_delete