2017-08-28 37 views
0

我有一個場景,我需要從​​對象中刪除完整的數據。如何從salesforce對象中刪除數據?

爲了實現,首先獲取該對象的所有Ids並以.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> 

請指教。

回答