TR_RE7INTEGRATIONCONFIGURATION_AUDIT_DELETE
Definition
Copy
/*
Generated by Blackbaud AppFx Platform
Date: 11/11/2014 4:15:09 PM
Assembly Version: Blackbaud.AppFx.Platform.SqlClr, Version=4.0.2.0, Culture=neutral, PublicKeyToken=null
Copyright Blackbaud
*/
CREATE TRIGGER dbo.TR_RE7INTEGRATIONCONFIGURATION_AUDIT_DELETE ON dbo.RE7INTEGRATIONCONFIGURATION AFTER DELETE NOT FOR REPLICATION
AS
declare @ChangeAgentID uniqueidentifier
declare @AuditKey uniqueidentifier
declare @AuditDate datetime
set nocount on
--peform the audit
if dbo.UFN_AUDITENABLED('RE7INTEGRATIONCONFIGURATION') = 1
begin
-- the audit key is used to associate the rows in the audit table with a single atomic deletion/modification
-- for a delete,
set @AuditKey = NewID()
set @AuditDate = GetDate()
--Get the change agent from the CONTEXT_INFO. If an application wishes to mark a row as deleted by a non-default changeagent then it will have to update the auditrow after the delete using the ID field (where AUDITTYPECODE=2)
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENTFROMCONTEXT @ChangeAgentID output
INSERT INTO dbo.RE7INTEGRATIONCONFIGURATIONAUDIT(
AUDITRECORDID,
AUDITKEY,
AUDITCHANGEAGENTID,
AUDITDATE,
AUDITTYPECODE,
[RE7DBID],
[RE7DBDESCRIPTION],
[RE7DBSERIALNUMBER],
[DBSELECTIONLOCKED],
[TORE7],
[FROMRE7],
[ADDEDBYID],
[CHANGEDBYID],
[DATEADDED],
[DATECHANGED],
[RE7WEBSERVER],
[CUSTOMCREDENTIALS],
[RE7WEBSERVER_USERID],
[RE7WEBSERVER_PASSWORD],
[RERPWEBSERVICEURL],
[RERPPROVISIONINGKEY],
[MAXSYNCBATCHSIZE]
)
SELECT
ID,
@AuditKey,
@ChangeAgentID,
@AuditDate,
2, --Before DELETE
[RE7DBID],
[RE7DBDESCRIPTION],
[RE7DBSERIALNUMBER],
[DBSELECTIONLOCKED],
[TORE7],
[FROMRE7],
[ADDEDBYID],
[CHANGEDBYID],
[DATEADDED],
[DATECHANGED],
[RE7WEBSERVER],
[CUSTOMCREDENTIALS],
[RE7WEBSERVER_USERID],
[RE7WEBSERVER_PASSWORD],
[RERPWEBSERVICEURL],
[RERPPROVISIONINGKEY],
[MAXSYNCBATCHSIZE]
FROM DELETED
end