#GPPT Using HMTL to format Password Reset Emails


David Meego - Click for blog homepageOne of the really useful features of the Database Tools module of GP Power Tools is the ability to send Password Reset Emails to users when their passwords are reset.

These emails can be sent when updating the password manually via the User Setup window or automatically when using the Database Validation or SQL Login Maintenance windows of GP Power Tools.

Note: Build 28.3 or later is required for the functionality discussed in this article to work.

To make this functionality work we need to associate an email address with each user in the system. As core Microsoft Dynamics GP does not have a place to store email addresses for each user and there might not be any correlation between the SQL Logins and the Windows User IDs, GP Power Tools provides a window for you to store additional data against a user.

The User Setup Additional Information window is available when the User Setup window is open. By default, it will open when User Setup is opened. It can also be opened from the Additional menu.

Note: The Default Site ID entered here is populated automatically into Sales Order Processing, Purchase Order Processing and Inventory transaction windows.

Whether you want this window opening automatically, where you want it opening and the User Defined Fields setup is controlled from the Options tab of the Administrator Settings window.

The User Defined Field prompts can be setup from this window. If you have the Developer Tools module of GP Power Tools registered, you can also setup a lookup using a SQL Lookup Script ID and decide if the selection should be validated against the values returned by the lookup (controlled by the checkbox).

Emails are sent when resetting passwords from:

  • The standard User Setup window.
  • The Database Validation window, which works when the SQL Logins and Database Users are damaged or missing as it repairs the SQL security settings to fix the users.
  • The SQL Login Maintenance window, which can be used to reset login settings and passwords for multiple users at a time.

To enable the sending of emails, on the Password Reset Email Settings window, the Send SQL Login Password reset emails option must be enabled.

There is default text in the body of the email, but it is very simple. So instead, the body of the email can be populated with HTML commands to format the email as desired. The characters ‘%1’ are used as the placeholder for the Password field and ‘%2’ is the placeholder for the User ID field.

Note: By entering a CC Address, the email will be cc’d to this address. If a user does not have an email address entered on the User Setup Additional Information window, the email will still be sent to the CC Address. This is handy when not all users have been set up with email addresses yet.

To specify that the email sent should be HTML rather than Plain Text, the Send HTML option on the Email Settings window should be selected. If this step is missed, the raw HTML will be sent as Plain Text.

Below is the raw HTML code that was used in the body of the email:


<table border="0" width="100%">
<tbody>
<tr>
<td style="padding: 0px;">
	
<table style="border: 1px solid #cccccc; border-collapse: collapse;" border="0" width="800" cellspacing="0" cellpadding="0" align="center">
<tbody>
		
<tr>
<td style="color: #ffffff; height: 175px; font-size: 28px; font-weight: bold; font-family: Arial, sans-serif;" align="center" bgcolor="#1d5778">

<strong>Welcome to Microsoft Dynamics GP</strong>

<strong>Password Reset</strong>
</td>
</tr>

		
<tr>
<td bgcolor="#ffffff">
		
<table border="0" width="100%">
<tbody>
<tr>
<td style="color: #1d5778; font-family: Arial, sans-serif; font-size: 24px;"><strong>Password Reset Requirement</strong></td>
</tr>


<tr>
<td style="padding: 0px 10px 0px 10px; color: #000000; font-family: Arial, sans-serif; font-size: 16px; line-height: 20px;">In order to access the Microsoft Dynamics GP Application, you will be required to enter a new password for GP. Below are the requirements for your new password followed by a temporary password. Please login and change your password to a new password of your choice. 
 
		    Your password must follow the below minimum conditions: 
 
		    &emsp; - length between 12 - 17 characters  
		    &emsp; - contain an Upper case 
		    &emsp; - contain a Lower case  
		    &emsp; - contain a special character 
 
		    Your temporary password for User ID <strong>'%2'</strong> is below: 
		    &emsp; %1 
		    <span style="color: red;"><strong>IMPORTANT:</strong></span> After 60 minutes of inactivity, your user will be logged out of GP automatically. 
		    If you have any issues, please create a helpdesk ticket for password assistance. 
		    Thank You,
 
		    GP Upgrade Team
		</td>
</tr>
</tbody>
</table>

	</td>
</tr>
</tbody>
</table>

</td>
</tr>
</tbody>
</table>


The resulting email will look very professional like the image below:

Thanks to Jamie Evenson and the team from Najaxa Software who decided to format the plain text default message into something much better looking. This example is based on the formatting they created. Updates to GP Power Tools were required to escape special characters that might exist in the User ID or Password, this is why build 28.3 or later is required.

Enjoy

David

This article was originally posted on http://www.winthropdc.com/blog.

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.