SQL Scripts for Microsoft Dynamics GP: Vendor Emil Addresses from Standard Fields and Active Docs

Microsoft Dynamics GPThis script is part of the SQL Scripts for Microsoft Dynamics GP where I will be posted the scripts I wrote against Microsoft Dynamics GP over the 19 years before I stopped working with Dynamics GP.

This script returns a list of email addresses for vendors from both the standard Dynamics GP fields as well as Active Docs. The email addresses from Active Docs are returned as a semi colon delimited list.

They were returned this way to allow users to check the returned email addresses and correct any incorrect ones, through the Active Docs window, before another script (which I’ll post soon) was run to migrate the emails from the Active Docs fields to the standard ones.

/*
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). */
SELECT ['PM Creditor Master'].VENDORID AS 'Creditor ID' ,['PM Creditor Master'].VENDNAME AS 'Creditor Name' ,['PM Creditor Master'].VADCDTRO AS 'Address Code' ,['Internet Addresses'].EmailToAddress AS 'GP Email To Address' ,['Internet Addresses'].EmailCcAddress AS 'GP Email Cc Address' ,['Internet Addresses'].EmailBccAddress AS 'GP Email Bcc Address' ,ISNULL((STUFF(( SELECT '; ' + RTRIM(EMail) FROM EMA00101 AS ['INNER'] WHERE ['INNER'].Email_Type = 1 AND ['INNER'].VENDORID = ['PM Creditor Master'].VENDORID ORDER BY VENDORID ,IntegerValue FOR XML PATH('') ), 1, 2, '') ),'') AS 'Active Docs Email To Address' ,ISNULL((STUFF(( SELECT '; ' + RTRIM(EMail) FROM EMA00101 AS ['INNER'] WHERE ['INNER'].Email_Type = 2 AND ['INNER'].VENDORID = ['PM Creditor Master'].VENDORID ORDER BY VENDORID ,IntegerValue FOR XML PATH('') ), 1, 2, '') ), '') AS 'Active Docs Email Cc Address' FROM PM00200 AS ['PM Creditor Master'] LEFT JOIN SY01200 AS ['Internet Addresses'] ON ['Internet Addresses'].Master_Type = 'VEN' AND ['Internet Addresses'].Master_ID = ['PM Creditor Master'].VENDORID AND ['Internet Addresses'].ADRSCODE = ['PM Creditor Master'].VADCDTRO

What should we write about next?

If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.

Your Name

Your Email

Suggested Topic

Suggestion Details

Looking for support or consultancy with Microsoft Dynamics GP?

I no longer work with Microsoft Dynamics GP, but the last company I worked for was ISC Software in the UK; if you’re looking for support or consultancy services with Microsoft Dynamics GP you can contact them here.

Leave a Reply

Your email address will not be published. Required fields are marked *