Mulesoft Salesforce连接器错误-(InvalidBatch:无法分析CSV,结束引号后不需要更多文本)

hs1rzwqc  于 2023-06-19  发布在  其他
关注(0)|答案(1)|浏览(110)

我正在尝试处理一个CSV文件(分隔符=逗号),该文件的列的值包含逗号、反斜杠、正斜杠和双引号。
CSV示例:

Id,Name,RecordTypeId,Start_Date__c,Collab_Data
8701928,John Revor,2022-09-01,"[{""respId"":""a2s2i000000HoE0AAK"",""details"":""Test Data""},{""respId"":""30928HoE2AAK"",""details"":""Test Data""},{""respId"":""30928HoE4AAK"",""details"":""English""},{""respId"":""30928HoECAA0"",""details"":""Test Data""},{""respId"":""30928HoEEAA0"",""details"":""Test Data""},{""respId"":""30928HoEGAA0"",""details"":""Test Data""},{""respId"":""30928HoEIAA0"",""details"":""Test Data""},{""respId"":""30928HoE6AAK"",""details"":""Test Data""},{""respId"":""30928HoE8AAK"",""details"":""Test Data""},{""respId"":""30928HoEKAA0"",""details"":""Test Data""},{""respId"":""30928HoELAA0"",""details"":""Test Data""},{""respId"":""30928HoETAA0"",""details"":""Test Data""},{""respId"":""30928HoEOAA0"",""details"":""test communication""},{""respId"":""30928HoEVAA0"",""details"":""Excellent""},{""respId"":""30928HoEWAA0"",""details"":""Test Data 123""},{""respId"":""30928HoEXAA0"",""details"":""Test Data 435""},{""respId"":""30928HoEaAAK"",""details"":""[{\""respId\"":\""30928HoEbAAK\"",\""details\"":\""180\""},{\""respId\"":\""30928HoEcAAK\"",\""details\"":\""479\""},{\""respId\"":\""30928HoEZAA0\"",\""details\"":10.393117283950618}]""}]

我首先为output-mime类型配置了File Read连接器,如下所示:

然后,当设置转换为java以进行进一步的Map逻辑时,使用以下dataweave:

%dw 2.0
input payload application/csv escape='"', quote='"'
output application/java
---
payload

最后,在使用Mulesoft Salesforce连接器(Create job bulk api v 2)添加到Salesforce之前,使用以下dataweave:

%dw 2.0
output application/csv separator=",",quoteValues=true,escape=""
---
payload //Here there is some simple logic set which has not been posted here

但Salesforce抛出了以下错误:
"InvalidBatch:无法分析CSV。结束引号后不需要更多文本"
什么原因可能导致问题?

093gszye

093gszye1#

您已经将输出csv的转义字符设置为空白字符。因此,它没有正确转义包含在值中的双引号。
若要使用双引号作为转义字符,请将输出导数更改为

output application/csv separator=",",quoteValues=true,escape='"'

在最终的DataWeave中

相关问题