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
Khaled YoussefKhaled Youssef 

alert email when anyone install my package in salesforces

how i procced to create a apex class or trigger class to  send automaticly an email alerts to notify me that my  package is downloaded ?
Rajiv Penagonda 12Rajiv Penagonda 12
Khaled, salesforce provides an option to include Post Installation Script as part of your package. This feature however is available only for managed packages. If your's is a managed package you can refer below links to created Post Installation Scripts for it.

https://help.salesforce.com/apex/HTViewHelpDoc?id=apex_post_install_script_intro.htm&language=en
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_install_handler.htm

Sample code below:
 
global class MyInstallationHandler implements InstallHandler {
	global void onInstall(InstallContext argContext) {
		Messaging.SingleEmailMessage lEmail = new Messaging.SingleEmailMessage();
		lEmail.setSubject('Someone Installed my Package!! yay!');
		lEmail.setHtmlBody('Congrats, you have a new Client!');
		lEmail.setSaveAsActivity(false);
		lEmail.setToAddresses(new List<String> {'test@test.com'});
		Messaging.sendEmail(new List<Messaging.Email> {lEmail}, false);
	}
}

Hope this helps.
Naval Sharma4Naval Sharma4
Hi Khaled,

This can be achieved using post installation script class in your package. A post install script always gets executed when a package is installed in a org.

For more information you can go through this link - https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_install_handler.htm
Thanks,
Naval 
Khaled YoussefKhaled Youssef
I apologize ur help , but i have another question , when a new client install a package , in which table i have a new record ( account or user ) or in another table ? . i have an idea to create a trigger in the table to send an email when i have a new record ? 
your opinion ? thanks 
Khaled YoussefKhaled Youssef
https://developer.salesforce.com/trailhead/project/salesforce_developer_workshop/creating_triggers