USP_DATAFORMTEMPLATE_ADD_EVENTWIDGET

The save procedure used by the add dataform template "Event Widget Add Data 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.
@WIDGETID int IN WidgetID
@EVENTID uniqueidentifier IN EventID
@DISPLAYTEXT nvarchar(4000) IN DisplayText
@ROLECODE tinyint IN Role code
@ISACTIVE bit IN IsActive
@ALLOWEDIT bit IN AllowEdit
@ALLOWMOVE bit IN AllowMove
@ALLOWREMOVE bit IN AllowRemove

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_EVENTWIDGET
(
    @ID uniqueidentifier = null output,
    @CHANGEAGENTID uniqueidentifier = null,

    @WIDGETID int = null ,
    @EVENTID uniqueidentifier = null,
    @DISPLAYTEXT nvarchar(4000) = '',
    @ROLECODE tinyint = 1,
    @ISACTIVE bit = 0,
    @ALLOWEDIT bit = 0,
    @ALLOWMOVE bit = 0,
    @ALLOWREMOVE bit = 0
)
as

set nocount on;

if @ID is null
    set @ID = newid()

if @CHANGEAGENTID is null  
    exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output

declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()

begin try
    -- handle inserting the data
    INSERT INTO dbo.EVENTWIDGET
        (ID, WIDGETID, EVENTID, DISPLAYTEXT, ROLECODE, ISACTIVE, ALLOWEDIT, ALLOWMOVE, ALLOWREMOVE, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
    VALUES
        (@ID, @WIDGETID, @EVENTID, @DISPLAYTEXT, @ROLECODE, @ISACTIVE, @ALLOWEDIT, @ALLOWMOVE, @ALLOWREMOVE, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)
end try

begin catch
    exec dbo.USP_RAISE_ERROR
    return 1
end catch

-- clear cache for front end data caching
exec dbo.USP_FAFDATACACHE_CLEAR @EVENTID=@EVENTID

return 0