I need to run a workflow that updates data in Salesforce if data already exists, or insert data if it doesn't.
The problem is: Salesforce runs a process builder that does not allow more than 100 rows to be inserted or updated at once.
To solve this problem, I need to run this workflow once, and when inserting/updating, do this every 100 rows until all data is inserted or updated.
Does anyone know how could I solve this?
The workflow I mentioned is scheduled to run once a day and the process builder needs to be active all day.
Thanks !
Solved! Go to Solution.
Hi @João_Marins
You can accomplish this using a batch macro technique
The container represents your data. Your data needs an incremental record number field, called ID in the example. The Batch Size Text Input tool contains a single cell with the number of records that you can pass to Salesforce. Append this value to your data and divide the record number by the batch size to get a batch number for each record. Summarize the batch number to get a unique list. This unique list is passed to the control input of a batch macro and the data is passed to Data Input
The macro uses a filter to select each batch in turn. The macro will run once for every record passed into the control input. In our case, that's once for each batch number. The Action tool updates the Filter with the current value of the Control parameter. the summarize and macro output are just there to represent your sales force tool. Replace these with your actual SalesForce output tool.
The first pass through the macro will pass all the records with BatchNumber=0 to the output. The second iteration will pass the records with Batchnumber=1, etc
Dan
Thanks so much for the answer! This saved my problem!
Only one question: did you copied the data from the formula tool output to the Macro input tool?
I need to Select some fields before I can input into salesforce. For the fileds to be recognized, should I copy this data to de macro input tool? And if I do that, each time the workflow runs, will the Macro input tool be updated with the new data?
Hi @João_Marins
Here's the easiest way to make the data in the Macro input match the fields passed in from the main workflow
In the results pane of the tool just before the macro input, select the first few rows and then press "Select Cells with Headers". Switch to your macro and paste the data. It will show up as an Text Input tool. Right click and select "Convert to Macro Input"
Disconnect the old Macro Input and connect this one. You'll need to modify the criteria to match your field names. Also remember to add a Select before your SalesForce output tool to remove any extra fields like BatchNumber
You only need to copy over a few rows. When the macro is called from a main program, the data passed in will replace the data in the Macro Input. The main purpose of the data in the Macro Input tool is to act as a template so the field names and types are defined. Adding a few rows makes it easier to debug when building the macro itself
Dan
It worked!
Thanks so much!