Bot to assign the records of a deleted user to another existing user

HELP
Practical example:
- I have a user registered on my system using the function: Usersettings();
- Everything that this user registers in the system leaves his user code recorded, so that we can identify who made the necessary registration;
- However, when I am excluding these Users because they are no longer part of the company, it turns out that in the other tables, that record is orphaned by a registrar. Only the code of that deleted user will be displayed, instead of their identification;
- My main objective would be to create a way in which, when deleting this user, the system would ask me if I would like to assign all of this user's records to any other user. This way, an (INPUT) box would open allowing another user to be selected, so that all the codes of the deleted user would be replaced by the code of another selected user.

Thank you very much for your precious time dedicated to this urgent matter of mine!

0 6 168
6 REPLIES 6

I would do like this:

1. Make a new table for the migration information

2. Make an action to go to the migration table's form view

3. When the data is added, run an automation to copy and then delete the user

Sorry friend chansol. But I didn't understand your answer. I think this is something very interesting, including for other people to be able to take advantage of this very useful automation, by the way.

Here is my user table.

chansol_0-1708062034975.png

And a migration table.

chansol_1-1708062106575.png

I made a custom delete button with:

  Do this > App: go to another view within this app

  Target > LINKTOFORM("Migration_Form", "From User", [User ID])

When I click the custom delete button, it will open a Migration form.

chansol_2-1708062218394.png

I can choose the From User and To User here.

chansol_3-1708062247647.png

If I press "Save", and a new record will be added to the Migration table.

I also made a bot with the EVENT: Data Change, Migration table, Adds only.

And it will run the PROCESS to Set the user code and Delete user.

chansol_5-1708062447152.png

And using AppSheet API, you can execute the according jobs.

The result will look like this:

1.gif

 

I understood your idea. It's almost correct. But the problem is bigger lol... It's about not changing the existing user code with the deleted one. It involves assigning the EXISTING USER code to all previous registrations made by the deleted User.
In short: All existing references to records made (in several tables) by the user to be deleted, will have to point to another existing user who will become the owner of the records made by the deleted user.

For example: You are going to delete a user from Wordpress, the system asks you: Who do you want to assign this user's publications to?

I prefer using Apps Script in this case. The script will find and change all existing user code to the new one from the DB.

Are you referring to Google Sheets App Script?

If so, consider this thought:

- (Adaptation to the sheet: Create a column [USER TO BE REPLACED]: which will receive the value: "Previous User ID Code";

- CONDITION: "If the User Table is edited and any user row receives this value above in this new created column, simply do:

- Action: Replace all current User Code ID" with the "previous User Code ID";

Would it be this?

Top Labels in this Space