USP_DATAFORMTEMPLATE_ADD_EVENTTASK_1_1
The save procedure used by the add dataform template "Event Task Select Event Add Form 1.1".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@EVENTID | uniqueidentifier | IN | Event |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@OWNERID | uniqueidentifier | IN | Owner |
@NAME | nvarchar(100) | IN | Name |
@COMPLETEBYDATE | datetime | IN | Date due |
@COMMENT | nvarchar(250) | IN | Comment |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_EVENTTASK_1_1
(
@ID uniqueidentifier = null output,
@EVENTID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@OWNERID uniqueidentifier = null,
@NAME nvarchar(100),
@COMPLETEBYDATE datetime = null,
@COMMENT nvarchar(250) = ''
)
as
begin
set nocount on;
declare @CURRENTDATE datetime
IF @ID is null
set @ID = newid()
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
set @CURRENTDATE = getdate()
begin try
if exists (select 1 from dbo.EVENTMANAGEMENTOPTIONS where EVENTID = @EVENTID and HASTASKSANDCOORDINATORS = 0)
raiserror('ERR_EVENTCANNOTHAVETASK', 13, 1);
insert into dbo.EVENTTASK
(ID, EVENTID, OWNERID, NAME, COMPLETEBYDATE, STATUSCODE, COMMENT, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@ID, @EVENTID, @OWNERID, @NAME, @COMPLETEBYDATE, 0, @COMMENT, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0
end