Skip to main content
All CollectionsUse-case guidesUsing action steps
Using the mass mutate step: insert
Using the mass mutate step: insert

Creating multiple records 1-by-1 can take up some time, with the bulk insert you can create them all in one go.

Updated over a week ago

After reading this article you'll know:

  • What the mass mutate step is

  • Why you'd use the mass mutate step for inserting records

  • How to use the mass mutate step in your application

Getting started

The mass mutate step can be found in the block store and is used to mass mutate data, this can be inserting-, upserting-, and deleting many records. To find the step go to the block store and search for 'mass', the mass mutate step should pop up.

Mass mutate block in the block store

Click on View details followed by Install block to install the block to the appropriate organization and application.

Mass mutate block installation

Once installed we can use the step in our application.


The following data models are pre-created to showcase what the step is about:

Pre-created data model scheme for the mass mutate use case

The above models form a questionnaire template, within this template we can then generate questionnaires using the mass mutate step.

Basically what we're doing in this use case is creating a questionnaire template with questions, then based on the number of employees in your employee model the template will be created a number of times with associated questions.

In this example, there's a handful of employees, but imagine if you have a huge enterprise and you need to create questionnaires for 20,000 employees. You can imagine that'd take quite some time by simply looping through that collection and then create the questionnaires plus the associated questions. A questionnaire that has 25 questions would result in half a million new records being created.

The power of mass mutate

The mass mutate makes the example above a lot faster, this step 'intercepts' the call to the database. So instead of doing a create half a million times, it'll save them up and then insert them in one go.

How does this work you might ask? This is the action that creates questionnaires based on the questionnaire template:

Mass mutate example in the action builder canvas

In the start step input variables are created that require the 'id' of a questionnaire template.

Mass mutate variable setting

We then create a normal variable that retrieves the object of the questionnaire template using a filter based on 'id' like so:

Mass mutate variable setting

And another variable to get the number of employees:

Mass mutate variable setting

The first step in the action is the mass mutate step. This step has no configuration required, it will actually work straight out of the box. Everything that happens in the step will be intercepted and inserted (or updated and/or deleted based what you want) in one go. Making the process of mass inserting a lot faster!

The next step is to loop through the employee collection like this:

Loop step setting in the mass mutate use case example

After that, we can create a questionnaire for each employee by adding a create step in the loop:

Create record step added to the mass mutate action flow

Still, in this loop, we'll have to add another loop that'll create a number of questions based on the question template model.

Loop step setting in the mass mutate use case example

And then we create these questions every iteration by adding a second create step within this loop:

Create record step added to the mass mutate action flow

And that's all.

If we execute this action and we provide an 'id' of the questionnaire template we'll create questionnaires for all our employees. In this use case I only have 8 employees and 3 questions in my template but when I run the action via the playground we can see that they're being created with the associated questions.


Mass mutate action flow outcome in the front end


Mass mutate action flow outcome in the front end

Did this answer your question?