function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bappabappa 

User deactivation : email alert

Hi All,

We would like to deactivate one user and want to assign another active user in all the email alerts,assignment rules associated with him.

1.We want to achieve it in a custom way.Because if there are 100 email alerts associated with the user we want to deactivate, manually it will take a lot of time.
2.Do we have any object from which we can get the data of email alerts,assignment rules related to a user?

Overall any idea related to deactivating a user succesfully and assign all its assignment rules and email alerts to other active users are welcome.

Thanks,
Best Answer chosen by bappa
Ashish_SFDCAshish_SFDC
Hi , 


Using the IDE works well for migrating metadata from one environment to another.  In addition if you need to make mass changes without having to click into a lot of items, this works well too.  Once you have the IDE installed you can access using Eclipse.  You will be able to create projects and connect to salesforce environments (Production and Sandbox).  You can select the metadata that you want to download into your project.  In your case, you would download the workflow email alerts.  Once downloaded you can access the metadata, that is presented in xml format.  You can make updates to the xml files or deploy as needed.

Your best bet is to use the force.com IDE (in eclipse) and download the meta data of all your email alerts.  You can then go into each email alert using eclipse and update the user assigned to the email alert to the new active user.    Once you are done with that you will be able to deactivate the user.

This will be a lot easier than having to click into each email alert in salesforce.

See the screenshots and detailed description on the thread below, 

https://success.salesforce.com/answers?id=90630000000gqM7AAI


Regards,
Ashish

All Answers

Ashish_SFDCAshish_SFDC
Hi , 


Using the IDE works well for migrating metadata from one environment to another.  In addition if you need to make mass changes without having to click into a lot of items, this works well too.  Once you have the IDE installed you can access using Eclipse.  You will be able to create projects and connect to salesforce environments (Production and Sandbox).  You can select the metadata that you want to download into your project.  In your case, you would download the workflow email alerts.  Once downloaded you can access the metadata, that is presented in xml format.  You can make updates to the xml files or deploy as needed.

Your best bet is to use the force.com IDE (in eclipse) and download the meta data of all your email alerts.  You can then go into each email alert using eclipse and update the user assigned to the email alert to the new active user.    Once you are done with that you will be able to deactivate the user.

This will be a lot easier than having to click into each email alert in salesforce.

See the screenshots and detailed description on the thread below, 

https://success.salesforce.com/answers?id=90630000000gqM7AAI


Regards,
Ashish
This was selected as the best answer
Magdiel HerreraMagdiel Herrera
I've had this same issue in the past and did exaclty as @Ashish_SFDC suggested, the link provided is very much complete,

These email alerts associated with workflows are stored as metadata (xml schema definitions),

There is another option which is using the ant migration tool from the command line, for retrieving/deploying metadata
https://developer.salesforce.com/page/Force.com_Migration_Tool

I use eclipse only for small orgs, for bigger orgs then ant tool is the best bet, as I've seen eclipse fail for deployments taking more than 30 min to complete.


bappabappa
Hi Ashish and Magdiel,

Thanks for your replies.

Using Eclipse or other migration tool will be our last option.

We would like to achieve in a custom way like below:

When someone clicks deactivate user, a trigger fires, getting the info of email alerts for that user calling metadata components from APEX and assign active user email from the class itself.

Or

A customized vf page for deactivating user, getting the info of email alerts for that user calling metadata components from APEX class and assign active user email from the class itself .

Would any of these possible?

I am also new in metadata API development. Please help.

Regards,
Sagar(bappa)
Ashish_SFDCAshish_SFDC
Hi Sagar, 


Currently the only option is to use IDE or ANT for the XML, 

Vite for the Idea which will hepl in this situation as well, 

Report on workflow, email alerts, etc.

https://success.salesforce.com/ideaview?id=08730000000BqJnAAK

Also see the related discussion, 

https://success.salesforce.com/answers?id=90630000000gjxfAAA


Regards,
Ashish