USP_DATAFORMTEMPLATE_ADD_CAMPAIGNTEAM
The save procedure used by the add dataform template "Campaign Team Add Form".
Parameters
| Parameter | Parameter Type | Mode | Description | 
|---|---|---|---|
| @ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. | 
| @ORGTEAMIDSET | uniqueidentifier | IN | Team | 
| @CAMPAIGNID | 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. | 
Definition
 Copy 
                                    
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_CAMPAIGNTEAM
(
  @ID uniqueidentifier = null output,
  @ORGTEAMIDSET uniqueidentifier = null,
  @CAMPAIGNID uniqueidentifier,
  @CHANGEAGENTID uniqueidentifier = null
)
as begin
  set nocount on;
  begin try
    if exists(select ID from dbo.CAMPAIGNTEAM where ORGTEAMIDSET = @ORGTEAMIDSET and CAMPAIGNID = @CAMPAIGNID)
      raiserror('BBERR_CAMPAIGNTEAM_UNIQUECAMPAIGNTEAM',13,1);
    declare @CURRENTDATE datetime;
    set @CURRENTDATE = getdate();
    if @ID is null
      set @ID = newid();
    if @CHANGEAGENTID is null
      exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
    insert into dbo.CAMPAIGNTEAM
    (
      ID,
      ORGTEAMIDSET,
      CAMPAIGNID,
      DATEADDED,
      DATECHANGED,
      ADDEDBYID,
      CHANGEDBYID
    )
    values
    (
      @ID,
      @ORGTEAMIDSET,
      @CAMPAIGNID,
      @CURRENTDATE,
      @CURRENTDATE,
      @CHANGEAGENTID,
      @CHANGEAGENTID
    );
  end try
  begin catch
    exec dbo.USP_RAISE_ERROR;
    return 1;
  end catch
  return 0;
end