When 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.
The below script creates a trigger on the SY04905 table to automatically flag the remittance to be emailed out in PDF format and using a Message ID of REMITTANCE.
/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (https://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_Remittance ON SY04905 AFTER Insert AS
-- Enable Remittance
UPDATE
Email
SET
EmailDocumentEnabled = 1
,EmailMessageID = 'REMITTANCE'
,EmailDocumentFormat = 3
FROM
SY04905 AS Email
INNER JOIN
inserted
ON Email.EmailDictionaryID = 0
AND Email.EmailSeriesID = 4
AND Email.MODULE1 = 19
AND Email.EmailCardID = inserted.EmailCardID
AND Email.EmailDocumentID = 6
GO