USP_INVITEERESEND_DELETEBYINVITATIONIDWITHCHANGEAGENTID

Deletes all invitee resend records with the given invitation ID.

Parameters

Parameter Parameter Type Mode Description
@INVITATIONID uniqueidentifier IN
@CHANGEAGENTID uniqueidentifier IN

Definition

Copy


            create procedure dbo.USP_INVITEERESEND_DELETEBYINVITATIONIDWITHCHANGEAGENTID
            (
                @INVITATIONID uniqueidentifier,
                @CHANGEAGENTID uniqueidentifier
            )
            as
                /*    
                Sets Context Info to the CHANGEAGENTID
                Deletes rows in the INVITEERESEND table with the given INVITATIONID
                Resets Context info to the previous value

                The Context Info will be used by delete triggers to log the AUDITCHANGEAGENTID 
                as the supplied @CHANGEAGENTID rather than the default change agent id.
                */

                set nocount on;

                declare @e int;
                declare @contextCache varbinary(128);

                begin try
                    /* cache current context information */
                    set @contextCache = CONTEXT_INFO();

                    /* set CONTEXT_INFO to @CHANGEAGENTID */
                    if not @CHANGEAGENTID is null
                        set CONTEXT_INFO @CHANGEAGENTID

                    delete from dbo.INVITEERESEND where INVITATIONID = @INVITATIONID;

                    /* reset CONTEXT_INFO to previous value */
                    if not @contextCache is null
                        set CONTEXT_INFO @contextCache
                end try

                begin catch
                    exec dbo.USP_RAISE_ERROR;
                    return 1;
                end catch

                return 0;