0
votes

I have tried to delete single id by setting it to "set payload" and calling cloud hub Salesforce connector with delete operation. its working fine.

in case of bulk deletion I am passing CSV file with salesforce accountid's. tried converting CSV to Object to string and split the no of rows and trying to pass it as collection for FOR each to delete in iteration.

I am new to Mule studio please correct me if am wrong and suggest best way to delete the id'd in CSV file

1
Can you post the code you're using to do it?brandonscript

1 Answers

0
votes

This may work:

Pass in a CSV of SFDC Ids without a header, then use the File to String transformer. You can then use this Groovy script to create a payload of Ids that you can pass into the Salesforce connector.

def ids =[:]
payload = payload.split('\n')
ids = payload.collect{['Id':"'"+(it)+"'"]}

return ids

Set the sObject Type in the connector and use #[payload] From Message as the Salesforce sObjects list

This will attempt to delete all Ids in the payload as a single statement so it can fail if you hit the app limits on update/delete in a single call. I put the connector inside of a For Each scope with a batch size of 25. This will delete 25 at a time and iterate until the entire payload has been processed.