Announcing batch activities - Manipulate multiple records in a single activity call

I am happy to announce that we have released a new set of activities that allow you to create, update or delete multiple records in a single activity call.

You will need to update your Data Service activities pack to version 21.1.2 to get these new activities. With the release, we have introduced three new activities -
image

These new activities accept and return a List<T> of entity records as input and output, compared to a single record as input and output for our standard create, update or delete activities. You can read more details about them on our activities help page - Data Service Studio Activities

These activities can accept up to 1000 records in a single call and each activity call will count as one call against your service usage quota.

Give them a try and let us know how you like them!

3 Likes

Can someone give an example on how to use the batch activities, all the videos can find is using a for each activity which I would assume wouldn’t be the case if it’s a batch upload.

Hi @Michaeljep,

The examples typically include For Each activity to iterate through the list of their records in either a data table or excel or other source, and a populate a list of type List(Of <entityType>) variable. Once you have the list variable, it can be passed to Batch activities as input.

I am attaching a sample to this answer, here are the steps to use it.

  • Create a new entity called “US States” in your Data Service instance with the following structure - image

  • Unzip the attached project, make sure you are connected to your Cloud Account tenant with your Data Service instance and run it.

  • It should create 50 records for the States in your instance and do it via 2 calls.

Batch Create to Data Service.zip (29.2 KB)

Let’s look at what I am doing within the project -
image

  1. I read the data from a CSV to a data table ->This can be from Excel or from scrapping as well).
  2. I set the batch size to 25 records → This is only because I want to update in batches of 25 records. The batch activities support up to 1000 records in a single call. I have used it as a sample to show how to handle scenarios where you may be creating/updating more than 1000 records. You will set the batch size to 1000 in that case.
  3. I have initialized the list variable to New List(Of USStates) to create an empty list.
  4. I am using a For Each loop to iterate through all records in my data from the CSV.
  5. For each row from my data table, I initialize a new variable and set the values for the three fields of type USStates.
  6. I add the new record to our earlier list using Add To Collection activity.
  7. Next, I check if the size of the collection has become equal to my batch size.
  8. If it has, I use the Create Multiple Entity Records activity to create all the records using a single call → Due to the If condition in #7, this call will be made only every 25 records in our case.
  9. After creating the records, I clear my collection so the next set of records will be added to it.
  10. As last step after the For loop, I make sure that there are no remaining records in the collection and make sure to create them before finishing the workflow → This is needed, in case where the count of records doesn’t exactly match our batch size. For ex, if we were creating 80 records, the If condition on #7 will have been satisfied on 25th, 50th and 75th record but not again after that. The remaining 5 records will be captured by our last If condition and created after the For loop.
1 Like

This absolute excellent, really a nice explanation and a school book example on how to reply :slight_smile:
Thanks so very much.

I’ll get straight into implementing it to my workflow.

1 Like

Hi, I created a plug and play solution for bulk upload just in case if anyone is looking for it. Make sure you remove the TEMP sequence and in_YourEntityList should be of type

in_YourEntityList =new List (Of EntityTypeCreatedByYou)

Bulk Upload Entity.zip (126.8 KB)

Hello @ankit.saraf

I am trying to use “Delete multiple entity records”. i dont know how to set the variable type for it.
List records are needed in the Create and Update multiple entity records.
BUT in Delete multiple entity records , the variable type is records of ids.




The records in the file are existed in the Data service already and i like to delete all using the delete multiple entity records . thank you ahead.

Hi @eimon, Sorry that our documentation was not clear on this, we will make it better.

For the Delete multiple entity records activity, you need the input to be either ICollection<Guid>, IList<Guid> or List<Guid>.

Here is a sample using the List<Guid> type which I populate from listRecords that I retrieve using Query activity. Notice that I initialize the recordsToDelete as New List<Guid> before I add items to it.