Update all records at once

joyanta sen asked on August 25, 2018 05:21

Hi, I need to update UserEnabled field for all the user in User module to false or true. Is there any way I can do the update in bulk instead fetching all the records and then using foreach to update?

Please let me know if there is any way to achieve this.

Thanks, Joyanta

Recent Answers


Brenden Kehren answered on August 25, 2018 05:45

If you're doing a one-time run I'd suggest updating the table directly in SQL. If you need to so it on a scheduled basis, I'd still use a SQL query but I'd call it from the API.

Be sure to clear the system cache after you do this so the change is found immediately for a given user.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.