You need to sign in to do that
Don't have an account?
SIVASASNKAR
Query to Identify all records owned by a User
Hi All,
I would like to query all SObject recrods owned by specific user, can you please guide me how can we do that?
My requirement:
We would like to deactivate the more Users in our org, hence instead of transfering the records for each user manually, require to implement through apex that all records will transfer from one User to another on button click. any alternative suggestion would be appriciated..
Thanks
Sivasankar.
I would like to query all SObject recrods owned by specific user, can you please guide me how can we do that?
My requirement:
We would like to deactivate the more Users in our org, hence instead of transfering the records for each user manually, require to implement through apex that all records will transfer from one User to another on button click. any alternative suggestion would be appriciated..
Thanks
Sivasankar.
You can do one thing populate all sobject in one picklist and click one button to call a method and in the method you can construct a dynamic query by passing selected picklist as sobject type in query and ownerid as your desired userid ,
Itetrate if the return record size is grater then zero then assign the new userid to the ownerid field and update that list .
Let me know if it helps .
Thanks
Manoj
Provide a custom button on Detail page - "Update owner". Clicking on button takes you to a page asking to select a new Owner. Selecting the new Owner and clicking button on custom page, updates all records of that sObject type with older Owner Id to the new Owner Id.
This implementation can be generalised to use for each and every sObject.
Thank you very much for your answers.
Manoj,
can you provide me code for building the dynamic query by passing the list of objects to get more clear on your suggestion. Are you suggesting SOSL query or SOQL query?
Thank you angain both.
Sivasankar.
Try with below code .You will get the list of records in search method after that you can do the manipulation what ever you want .
Please let me know if it helps .
Thanks
Manoj
Thank you very much for your time and much approciated. We have similar standard functionality to Mass transfer the records by individual objects. But Users are not willing to do this activity for every object they are expecting that when User hits the Deactivate button page will open to prompt the new user to replace and transfer the recrods to new owner. After selecting the new owner and hit the OK button, mass transfer should be happen to new user irrespective of SObject Type.
Hence I have queried to retrieve all the records owned by User irrespective of SObject. If we get all records then we can chage the Owner of records. I hope you got th point, please let me know if you require any more information.
Thank you again for you time on this.
Thanks
Sivasankar.
Have you got any update for your request?
Even i'm looking for the same logic for my requirement, which you have mentioned above.
Thanks for your help in advance.
Regards,
7J
Have you got any solution for your request?
I'm looking for the same requirement, which you have mentioned above.
Thanks,
Pooja
Have you got any solution for your request?
I am looking for related requirement
Requirement:We need to create a Lightning where you will get all the records related to that particular User. And you can replace or Change the name for that records.