USP_DATAFORMTEMPLATE_ADD_MKTSEGMENTSPONSORSHIP_PRELOAD

The load procedure used by the edit dataform template "Sponsorship Segment Add Form"

Parameters

Parameter Parameter Type Mode Description
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@QUERYVIEWCATALOGID uniqueidentifier INOUT Record source
@SMARTQUERIESEXIST bit INOUT Smart queries exist
@SELECTIONTYPE tinyint INOUT Selection type
@SITEID uniqueidentifier INOUT Site
@SITEREQUIRED bit INOUT Site required?
@SEGMENTPARTDEFINITIONID uniqueidentifier INOUT

Definition

Copy


CREATE procedure dbo.[USP_DATAFORMTEMPLATE_ADD_MKTSEGMENTSPONSORSHIP_PRELOAD]
(
  @CURRENTAPPUSERID uniqueidentifier,
  @QUERYVIEWCATALOGID uniqueidentifier = null output,
  @SMARTQUERIESEXIST bit = null output,
  @SELECTIONTYPE tinyint = null output,
  @SITEID uniqueidentifier = null output,
  @SITEREQUIRED bit = null output,
  @SEGMENTPARTDEFINITIONID uniqueidentifier = null output
)
as
  set nocount on;

  set @SELECTIONTYPE = 4;

  -- check for sponsorship-based smart queries

  select @SMARTQUERIESEXIST = dbo.[UFN_MKTSELECTION_SMARTQUERIESEXIST](@SELECTIONTYPE);

  declare @T1 table([VALUE] uniqueidentifier, [LABEL] nvarchar(255));
  -- if there is only one valid record source, then default it

  insert into @T1
    exec dbo.[USP_SIMPLEDATALIST_MKTRECORDSSOURCE] @CURRENTAPPUSERID;

  if @@ROWCOUNT = 1
    select @QUERYVIEWCATALOGID = [VALUE]
    from @T1;

  set @SITEID = dbo.[UFN_APPUSER_DEFAULTSITEFORUSER](@CURRENTAPPUSERID);
  set @SITEREQUIRED = dbo.[UFN_SITEREQUIREDFORUSERONFEATURE](@CURRENTAPPUSERID, '84029ec7-4c9f-40e8-91fc-dd9e057b3282', 1);

  select @SEGMENTPARTDEFINITIONID = [ID] from dbo.[MKTSOURCECODEPARTDEFINITION] where [ITEMTYPECODE] = 1;

  return 0;