Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 53708

SQL Trigger To Automatically Enable Email Documents In Purchasing – Purchase Orders

$
0
0

Microsoft Dynamics GPWhen creating a new vendor there is a fair bit of information which needs to be entered and it is sometimes nice to reduce the amount which needs to be done manually; in the last post I had a script to enable the email document for Check Remittances.

The below script creates a trigger on the SY04905 table to automatically flag the purchase orders to be emailed out in PDF format and using a Message ID of PURCHASEORDER respectively.

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (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).
*/CREATE TRIGGER utr_AZRCRV_Update_SY04905_Activate_PO ON dbo.SY04905 CREATE TRIGGEAFTER Insert AS-- Enable Purchase OrderUPDATE
		EmailSET
		EmailDocumentEnabled = 1,EmailMessageID ='PURCHASEORDER',EmailDocumentFormat = 3FROM
		SY04905 AS EmailINNER JOIN
		insertedON Email.EmailDictionaryID = 0AND Email.EmailSeriesID = 4AND Email.MODULE1 = 12AND Email.EmailCardID = inserted.EmailCardIDAND Email.EmailDocumentID = 1GO

Viewing all articles
Browse latest Browse all 53708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>