USP_DATAFORMTEMPLATE_ADD_PROSPECTFUNDINGINTEREST
The save procedure used by the add dataform template "Prospect Funding Interest 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. |
@PROSPECTID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@FUNDINGTYPECODEID | uniqueidentifier | IN | Funding type |
@INTERESTLEVELCODE | tinyint | IN | Level of interest |
@COMMENT | nvarchar(max) | IN | Comments |
@SITES | xml | IN | Sites |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_PROSPECTFUNDINGINTEREST (
@ID uniqueidentifier = null output,
@CHANGEAGENTID uniqueidentifier = null,
@PROSPECTID uniqueidentifier,
@FUNDINGTYPECODEID uniqueidentifier,
@INTERESTLEVELCODE tinyint = 2,
@COMMENT nvarchar(max) = '',
@SITES xml = null
)
as begin
set nocount on;
declare @CURRENTDATE datetime = getdate();
if @ID is null
set @ID = newid();
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
begin try
insert into dbo.PROSPECTFUNDINGINTEREST
(
ID,
PROSPECTID,
FUNDINGTYPECODEID,
INTERESTLEVELCODE,
COMMENT,
ADDEDBYID,
CHANGEDBYID,
DATEADDED,
DATECHANGED
)
values (
@ID,
@PROSPECTID,
@FUNDINGTYPECODEID,
@INTERESTLEVELCODE,
@COMMENT,
@CHANGEAGENTID,
@CHANGEAGENTID,
@CURRENTDATE,
@CURRENTDATE
);
-- insert sites
exec dbo.USP_PROSPECTFUNDINGINTEREST_GETSITES_ADDFROMXML @ID, @SITES, @CHANGEAGENTID;
end try
begin catch
exec dbo.USP_RAISE_ERROR;
return 1;
end catch
return 0;
end