The function is called batchAnd() and it takes 3 parameters:

  • action – expects a string value of either ‘Update’, ‘Create’, or ‘Delete’ (if some other string value is provided, the function will add a message to the block’s output informing the user of the error)
  • table – expects a Table object reference to call .[action]RecordsAsync() on
  • records – expects an Array of records to perform the action on, formatted in the way the .[action]RecordsAsync() function from the SDK expects

In the case of success, the function returns either an integer equal to the number of records that were processed by the function (this is the case for the ‘Update’ and ‘Delete’ paths), or an array of the recordId’s of the new records created by the function (this is the case for the ‘Create’ path); if the function doesn’t run due to a bad parameter, it returns null. This return value can be used to check if the function was successful before deciding what to output at the end of a Script.

Just copy-paste that function into your Scripting Block code (probably at the very end), and you can use the function to handle all of your .createRecordsAsync().updateRecordsAsync(), and .deleteRecordsAsync() calls.

 

To see the entire script explanation click here.