Question

I'm new to mule soft and I'm trying fetch from salesforce and trying to write it into an excel file. For the first try it works fine, however when I do it again and try to append the the output to the same file my excel file gets corrupted

  <sfdc:config name="Salesforce1" username="*****"
            password="****" securityToken="******"
            doc:name="Salesforce">
            <sfdc:connection-pooling-profile
                initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW" />
        </sfdc:config>
        <data-mapper:config name="contact_to_ms_excel" transformationGraphPath="contact_to_ms_excel.grf" doc:name="contact_to_ms_excel"/>
        <file:connector name="Fileoutput" outputPattern=".xls"  autoDelete="true" outputAppend="true" streaming="true" validateConnections="true" doc:name="File"/>
        <flow name="trial2Flow1" doc:name="trial2Flow1">
            <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
            <not-filter doc:name="Not">
                <wildcard-filter pattern="/favicon.ico" caseSensitive="true"/>
            </not-filter>
            <custom-transformer class="Trial" doc:name="Java"/>
            <sfdc:query config-ref="Salesforce1"
                query="select  Phone,Name,Email from Contact WHERE Title ='#[payload]'" doc:name="Salesforce" />
            <data-mapper:transform config-ref="contact_to_ms_excel" doc:name="Contact To MS Excel"/>
            <file:outbound-endpoint path="C:\Users\Suja\exltrial\excel"  responseTimeout="10000" doc:name="File" connector-ref="Fileoutput" outputPattern="Scontact.xls"/>
        </flow>
    </mule> 

Could some one let me know what could be the reason.

Thank you in advance.

Was it helpful?

Solution

You can not append the data from two binary files into a single binary file with an appending file connector. Append the data to a CSV file and then transform that to XLS, or try to find some Java library that can combine two XLS files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top