USP_DATAFORMTEMPLATE_ADD_ACTION_ITEM_MEDIA_TARGET
The save procedure used by the add dataform template "Action Item Media Target Add Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@ACTIONITEMID | uniqueidentifier | IN | Actionitem |
@CATEGORYLIST | nvarchar(1000) | IN | CategoryList |
@SENDTYPECODE | tinyint | IN | Sendtype |
@ISDELETE | bit | IN | IsDelete |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_ACTION_ITEM_MEDIA_TARGET
(
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@ACTIONITEMID uniqueidentifier,
@CATEGORYLIST nvarchar(1000),
@SENDTYPECODE tinyint = 0,
@ISDELETE bit = 0 -- 0:Nodelete, 1:delete all
)
as
set nocount on;
if @ID is null
set @ID = newid()
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
if @ACTIONITEMID is not null and @ISDELETE = 1
DELETE FROM ACTIONITEMMEDIATARGET WHERE ACTIONITEMID = @ACTIONITEMID
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
begin try
-- handle inserting the data
insert into dbo.ACTIONITEMMEDIATARGET (ID, ACTIONITEMID, CATEGORY, SENDTYPECODE, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
SELECT newid(),@ACTIONITEMID, element_value, @SENDTYPECODE, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE
FROM dbo.UFN_PARSE_STRING(@CATEGORYLIST,',')
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0