USP_DATAFORMTEMPLATE_ADD_FAFEVENT_PRELOAD

The load procedure used by the edit dataform template "FAF Event Add Form"

Parameters

Parameter Parameter Type Mode Description
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@ATTRIBUTEDEFINED bit INOUT Event attributes defined
@SITEREQUIRED bit INOUT Site required
@SITES xml INOUT
@INTEGRATIONURL nvarchar(1024) INOUT
@ISFIRSTFAF bit INOUT

Definition

Copy

CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_FAFEVENT_PRELOAD
(
    @CURRENTAPPUSERID uniqueidentifier,
    @ATTRIBUTEDEFINED bit = null output,
    @SITEREQUIRED bit = null output,
    @SITES xml = null output,
  @INTEGRATIONURL nvarchar(1024) = null output,
  @ISFIRSTFAF bit = null output
)
as
    set nocount on

    declare @DEFAULTSITEID uniqueidentifier,
          @USERDEFAULTSITEID uniqueidentifier        

    if fulltextserviceproperty('IsFulltextInstalled') = 0
            or OBJECTPROPERTY(OBJECT_ID('[dbo].CONSTITUENT'), 'TableHasActiveFulltextIndex') = 0
            or OBJECTPROPERTY(OBJECT_ID('[dbo].PARTICIPANTEMAILTEMPLATE'), 'TableHasActiveFulltextIndex') = 0
            or OBJECTPROPERTY(OBJECT_ID('[dbo].EMAILTEMPLATE'), 'TableHasActiveFulltextIndex') = 0
        raiserror('Sql Server Fulltext Index component is required to create a FAF event, but is not installed or not initialized.
                Contact your administrator.
                Run the Microsoft SQL Server Install and enable the Full-Text Indexing option.
                Rerun the Service Pack for your current version SQL Server in order to update the Indexing Service to the concurrent version.
                Execute the spCreateFullTextIndicesForFafSearch procedure in your Database.
        ',13,1);

    set @ATTRIBUTEDEFINED = dbo.UFN_ATTRIBUTECATEGORY_DEFINEDFORRECORDTYPE_FORAPPUSER('EVENT',@CURRENTAPPUSERID);
    set @SITEREQUIRED = dbo.UFN_SITEREQUIREDFORUSER(@CURRENTAPPUSERID);

  set @INTEGRATIONURL = dbo.UFN_BBNC_URL();

  if not exists(select top 1 ID from dbo.EVENTEXTENSION)
    set @ISFIRSTFAF = 1
  else
    set @ISFIRSTFAF = 0

    select @USERDEFAULTSITEID = SITEID from dbo.APPUSER where APPUSER.ID = @CURRENTAPPUSERID 

  set @DEFAULTSITEID = dbo.UFN_APPUSER_DEFAULTSITEFORUSER(@CURRENTAPPUSERID)

    if @USERDEFAULTSITEID is not null
    select @SITES = (
      SELECT newID() as ID, S.ID as [SITEID], S.NAME
     FROM dbo.[SITE] S where S.ID = @USERDEFAULTSITEID
     for xml raw('ITEM'),type,elements,root('SITES'),BINARY BASE64 )

  if @SITEREQUIRED = 1
  begin 
    if @USERDEFAULTSITEID is null
      raiserror('You are not assigned to a default site. To continue, contact your administrator and verify your default site setup.', 13,1);
    else
      if dbo.UFN_APPUSER_DEFAULTSITEFORUSER(@CURRENTAPPUSERID) is null
         raiserror('Your default site is not included in your role?s record access.  To continue, contact your administrator and update your role.', 13,1);
  end


    return 0;