Using the Professional Services Library: ClientEmail
The ClientEmail function in the Professional Services Library allows the developer, using MetaScript, to open a new "Compose Message" window using the default email client defined in the user's operating system.
The following script demonstrates the usage of ClientEmail in the Professional Services Library:
//@version "2.0" //@include "database:PS.js" function ClientEmailContact() { // Get all required pieces of information for the email var email = Field( 'Customer_Email_1' ); var subject = "Job Number "+Field( 'Job Number' )+" has been completed."; var message = "Job "+Field( 'Job Number' )+" has been completed, and can be picked up at the central desk."; // Do we want to use the built-in alert if the email is empty? var generate_alert = false; // Test to ensure the email client has been opened if(!PS.ClientEmail( email, subject, message, generate_alert)){ alert("There was a problem opening the default mail client."); } }
A common use of the ClientEmail function is on a button click, allowing the user to modify the subject, message, or even attach a file.