如何将文件上传到salesforce,其大小超过10,000,000个字符?

时间:2017-10-13 10:08:51

标签: file salesforce mule

我有一个工作流程可以将文件从sharepoint上传到salesforce。它工作正常。

最近确定了salesforce end存在最大批量限制的问题,即单个批次最多包含10,000,000个字符。当一个包含超过10,000,000个字符的大文件时。它无法上传到salesforce并且低于错误。

我还有其他方法可以在一个批次中将超过10,000,000个字符上传到salesforce。我无法在一批中发送一半文件而在另一批中发送另一半,因为同步问题出现了。

代码:

  <enricher target="#[flowVars['jobInfo_upload']]" doc:name="Enricher jobId insert">
                    <sfdc:create-job config-ref="SFA_NOL_SHAREPOINT" type="ContentVersion" concurrencyMode="Parallel" contentType="XML" operation="insert" doc:name="Create Job"/>
                </enricher>
                <expression-component doc:name="Expression to save jobid"><![CDATA[sessionVars.jobInfo_upload = flowVars.jobInfo_upload.id]]></expression-component>
                <dw:transform-message metadata:id="1dec8ccb-75ec-4be9-933e-06eb92354eba" doc:name="Transform Message">
                    <dw:set-payload><![CDATA[%dw 1.0
%output application/java
---
[{
    Title: flowVars.filename,
    PathOnClient: flowVars.path,
    TagCsv: "Sharepoint Version: " ++ flowVars.MajorVersion ++ "." ++ flowVars.MinorVersion,
    VersionData: payload,
    FirstPublishLocationId: flowVars.FirstPublishLocationId
}]]]></dw:set-payload>
                </dw:transform-message>
                <sfdc:create-batch config-ref="SFA_NOL_SHAREPOINT" doc:name="Insert">
                    <sfdc:job-info ref="#[flowVars.jobInfo_upload]"/>
                    <sfdc:objects ref="#[payload]"/>
                </sfdc:create-batch>

错误:

09:51:01.348     10/13/2017     Worker-0     [apl-sfa-sharepoint-interface].batch-upload-simpleBatchFlow.stage1.17     ERROR

********************************************************************************
Message               : Failed to invoke createBatch. Message payload is of type: ArrayList
Type                  : org.mule.api.MessagingException
Code                  : MULE_ERROR-29999
JavaDoc               : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
Payload               : [{Title=Customer Presentation Deck_Template (October 2017).pptx, PathOnClient=/Users/dangnguyen/sharepoint/ Deck_Template.pptx, TagCsv=Sharepoint Version: 1.0, VersionData=UEsDBBQABgAIAAAAIQD9wUeU7QUAADV9AAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADMnU1v20YQhu8F+h8EXQuLH5IoKrCdQ...
********************************************************************************
Exception stack is:
1. ClientInputError : Failed to read request. Exceeded max size limit of 10000000 (com.sforce.async.AsyncApiException)
  com.sforce.async.BulkConnection:180 (null)
2. ClientInputError : Failed to read request. Exceeded max size limit of 10000000 (org.mule.modules.salesforce.exception.SalesforceException)

1 个答案:

答案 0 :(得分:3)

批量API本身有限制。

https://www.salesforce.com/us/developer/docs/api_asynch/Content/asynch_api_concepts_limits.htm

数据加载批次可以包含一个不超过10 MB的CSV或XML文件。

批次最多可包含10,000条记录。

批次中的所有数据最多可包含10,000,000个字符。

字段最多可包含32,000个字符。

记录最多可包含5,000个字段。

记录的所有字段最多可包含400,000个字符。

批处理必须包含某些内容或发生错误。

因此,您应该将输入文件分成小于这些限制的文件。