Update Microsoft Dynamics GP Customer Emails on Test Including Sent Emails

Microsoft Dynamics GPAfter creating a new script for updating vendor emails on test which includes the emails of sent items, I figured that a similar script will be needed to update the email address on sent emails in the Sales Series.

The script below, includes the tables holding sent email information for the Sales Series emails (both Receivables Management and Sales Order Processing) as well as the usual Internet Addresses table; the highlighted email address can be changed to whatever email address you’re using for testing your Sales emails:

/*
Created by Ian Grieve of azurecurve | Ramblings of an IT Professional (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
DECLARE @TestEmail VARCHAR(100) SET @TestEmail = 'email@example.com' -- UPDATE existing email addresses UPDATE SY01200 --Internet Addresses (SY01200) SET INET1 = @TestEmail ,EmailToAddress = @TestEmail ,EmailCcAddress = '' ,EmailBccAddress = '' WHERE Master_Type = 'CUS' -- UPDATE Email Details of previously sent emails UPDATE SY04910 --Email Details (SY04910) SET EmailToAddress = @TestEmail ,EmailCcAddress = CASE WHEN LEN(CAST(EmailCcAddress AS VARCHAR(1000))) = 0 THEN '' ELSE @TestEmail END WHERE MODULE1 IN (9,11) -- Receivables Management / Purchase Order Processing -- UPDATE Email Details of previously sent emails UPDATE SY04915 --Email History (SY04915) SET EmailToAddress = @TestEmail ,EmailCcAddress = CASE WHEN LEN(CAST(EmailCcAddress AS VARCHAR(1000))) = 0 THEN '' ELSE @TestEmail END WHERE MODULE1 IN (9,11) -- Receivables Management / Purchase Order Processing GO