USP_MKTLISTLAYOUT_ROLLBACK
Executes the "List Layout: Rollback" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being deleted. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the delete. |
Definition
Copy
CREATE procedure dbo.[USP_MKTLISTLAYOUT_ROLLBACK]
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
begin
/* Since this should only be called when adding a new layout and the list import fails, we can just use the LayoutID */
/* to find the right list to modify and delete the invalid layout. */
set nocount on;
declare @CURRENTDATE datetime;
begin try
if @CHANGEAGENTID is null
exec dbo.[USP_CHANGEAGENT_GETORCREATECHANGEAGENT] @CHANGEAGENTID output;
set @CURRENTDATE = GetDate();
/* Update the List Segment table to avoid foreign key errors when we delete the Layout. */
update dbo.[MKTSEGMENTLIST] set
[LISTLAYOUTID] = null,
[CHANGEDBYID] = @CHANGEAGENTID,
[DATECHANGED] = @CURRENTDATE
where [LISTLAYOUTID] = @ID;
/* Delete the Layout. */
exec dbo.[USP_MKTLISTLAYOUT_DELETE] @ID, @CHANGEAGENTID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;
end