Mass Update Records Through Batch Processing

How to update the same field for multiple records via customization

Updated over a week ago

There are many times where you want to update one field on multiple records, and you don't want to do it one at a time. It is possible to do a mass update for multiple records at once by customizing a screen to do the batch processing for you. 

For example, below is a list of activities. I may wish to reassign activities currently assigned to Errol to a completely different user, like Sam. Or perhaps, I may want to select a number of records and close all of them at once. 

Doing a batch process of records is currently doable through customization. The trick is figuring out how to go about it. In the above example, I gave two scenarios. These two scenarios would be customized differently. 

In the first scenario, I wanted to change all records assigned to Errol so that it would be assigned to Sam. In this case, I am able to define the criteria that would exactly filter the records I wanted to change. In this case, I would be able to use a single Update Fields in Table action. 

In the second scenario, the user would be selecting the activities. Since I have no idea what records they would choose, I would not be able to define the criteria that would exactly filter the records I want to change. In this case, you would need to show checkboxes on the grid, and use the Loop through Grid action in conjunction with the Update Fields in Table action.

In this article, we will provide examples for these two methods. Unfortunately, we would not be able to provide examples for every single case of batch processing possible, so it is important to understand how the concept work.

Note: Be careful with this! Once you change records on mass, it is permanent. You may not be able to undo the mass update, except manually by hand. Make sure you understand how this works before changing a large number of records.

Updating Records Where the Criteria is Definable

As long as you can create the criteria to define the records, then this scenario can be done with the use of one Update Fields in Table action. Here are examples of criteria that can be defined, regardless of what needs to be updated:

  • All records with a start date greater than yesterday.

  • All records with the contact of Bob Crenshaw.

  • All records assigned to Errol Elumir.

  • All records set to inactive. 

  • All records. Every single one of them. 

In the following example, we are going to replace all activities assigned to one Method:CRM user, and re-assign them to another. For simplicity, we will create two dropdown fields for the user to choose two Method:CRM users, and then another button to execute the re-assignment, as shown below:

Create the Interface

The first step will be to create the interface. You could do this anywhere, even on a new screen if need be, but for this example, we are going to customize the Activity screen

1. Customize the Activity List Screen.

2. Drag in a new section onto the canvas.

   a. Name it secReassign.
   b. Move it up so it's underneath secNav.
   c. Split it into two columns and set the width of the columns to 50%.
   d. Add 1x padding to the section's top and bottom.

3. Into the right column of secReassign, drag in another new section.

   a. Name it secReassignInner.
   b. Split it into three columns.
   c. Add 1x to the left padding of each cell of each column. 

4. Into the first column of secReassignInner, drag in a dropdown object.
   a. Name it UserOld.
   b. Change its base table to Users.
   c. Add the column UserName to this dropdown object. 

5. Into the second column of secReassignInner, drag another dropdown object, and do the exact same above steps but name it UserNew

6. Into the third column of secReassignInner, drag in a button object, and name it Reassign.

If properly set up, it should look like this.

Now we are ready to add actions to the button!

Add Actions to Reassign User

1. Select the ▼ icon on UserOld and select Validation Rules.

2. Add in the validation rule: Field is Required

3. Select the ▼ icon on UserNew and select Validation Rules.

4. Add in the validation rule: Field is Required.

5. Select the ▼ icon on the Reassign button and select the Click event.

6. Add action Validate Controls on Screen (make sure the dropdown isn't empty).

7. Add action Show Message (always have a confirmation message).

   a. For Title: "Confirmation."
   b. For Message, type in "Reassign all the activities belonging to".
   c. For Insert a value into the message select "UserOld - Display".
   d. For Message again, append "and give them to".
   e. For Insert a value into the message select "UserNew - Display".
   f. For Show these buttons(s), select OK/Cancel.
   g. For Internal notes: "Confirm user reassignment for activities".

8. Add action Update Fields in Table.

   a. For Select a table, choose Activity.
   b. Click Open criteria Builder.
        i. Add a condition.

       ii. First field: AssignedTo - RecordID.
       iii. Second field: Is Equal (default).
       iv. Third field: UserOld - RecordID.
       v. Go < Back.

   c. For Field(s) to update, select AssignedTo - RecordID.
   d. For Update using this value, select UserNew - RecordID.
   e. For Internal notes: "Change old user to new user for activity".

9. Add action Refresh Control (refresh the activities grid).
   a. For Select a control choose ActivitiesGrid.
   b. For Internal notes: "Update Activities Grid".

10. In the upper right, click Close to finish adding actions.

And you're done! Your action set should look like this:

Close the design screen and test your button out. It would be good to use test data first, of course.

Updating Records Where the Criteria cannot be Defined

The second scenario is where the criteria cannot be easily defined using the criteria builder. For example, when a user has selected specific records from a grid. For this, we can loop through the grid and only process the records that are checked. 

In the following example, we are going to allow the user to select activities in a grid, and with a single click, they can mark them as completed.

1. Customize the Activity List screen. 

2. Find and select the ActivitiesGrid object inside secActivityList section.

3. In its properties, expand the Columns section and check off Has a Checkbox Column.

4. Within secActivityList, right click on the cell, select Row, then select ⊕ Insert Above

5. Select that new row you added and change its Cell Alignment to the upper right and its bottom padding to 1x.

6. Into that new row, drag in a Text object.

7. Change the Text on this new text object to "Complete Selected".

8. Select the ▼ menu dropdown on the new text object and click its Click event.

9. Add action Show Message (always have a confirmation message).
   a. For Title: "Confirmation."
   b. For Message, type in "Are you sure you wish to mark these actions complete?"
   c. For Show these buttons(s), select OK/Cancel.
   d. For Internal notes: "Confirm completion for activities".

10. Add action Loop Through Grid.
   a. For Select a grid, choose ActivitiesGrid.
   b. Check Only select rows that are checked.
   c. For Internal notes: "Loop through checked rows of activities grid".

11. Select the ⊕ symbol on Loop Through Grid. This will ensure the next action added is embedded within the loop. 

12. Add action Update Fields in Table.

   a. For Select a table, choose Activity.
   b. Click Open criteria Builder.
        i. Add a condition.

        ii. First field: RecordID.
        iii. Second field: Is Equal (default).
        iv. Third field: RecordID underneath the Loop heading in the dropdown!
        v. Go < Back.
   c. For Field(s) to update, select AcitivityStatus - Display.
   d. For Update using this value, use the text "Completed" (no quotation marks).
   e. For Internal notes: "Mark activity completed."

13. Add action Refresh Grid (this time outside of the loop).
   a. For Select a control choose ActivitiesGrid.
   b. For Internal notes: "Update Activities Grid".

14. In the upper right, click Close to finish adding actions.

And you're done! Your action set should look like this:

Close the design screen and test this out. It would be good to use test data first, of course.

Did this answer your question?