USP_DATAFORMTEMPLATE_ADD_USERDEFINEDELEMENT
The save procedure used by the add dataform template "User-defined Element Add Data Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@ACCOUNTSTRUCTUREID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@SHORTID | nvarchar(100) | IN | ID |
@DESCRIPTION | nvarchar(60) | IN | Description |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_USERDEFINEDELEMENT
(
@ID uniqueidentifier = null output,
@ACCOUNTSTRUCTUREID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier = null,
@SHORTID nvarchar(100) = '',
@DESCRIPTION nvarchar(60) = ''
)
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
begin tran;
--Populate the accounting element table first for common fields
exec dbo.USP_DATAELEMENT_ADD @ID output, @SHORTID, @DESCRIPTION, 3, 0,null,null,0,null,null, @ACCOUNTSTRUCTUREID, @CHANGEAGENTID
insert into dbo.USERDEFINEDELEMENT(ID, ADDEDBYID, CHANGEDBYID, DATEADDED, DATECHANGED)
values
(@ID, @CHANGEAGENTID, @CHANGEAGENTID, @CURRENTDATE, @CURRENTDATE)
commit tran;
end try
begin catch
rollback tran;
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0