USP_DATAFORMTEMPLATE_PRELOAD_PROSPECTRESEARCHREQUEST
The load procedure used by the edit dataform template "Prospect Research Request Add Form"
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. |
@STATUSCODE | tinyint | INOUT | Status |
@RECORDTYPECODE | tinyint | INOUT | Record type |
@CONSTITUENTS | xml | INOUT | Prospects to research |
@CONSTITUENTNAMES | xml | INOUT | Prospects to research |
@EVENTID | uniqueidentifier | INOUT | Event to include in request |
@RESEARCHGROUPID | uniqueidentifier | INOUT | Research group to include in request |
@PROSPECTRESEARCHREQUESTPRIORITYCODEID | uniqueidentifier | INOUT | Priority |
@DUEDATE | date | INOUT | Due date |
@PROSPECTRESEARCHREQUESTTYPECODEID | uniqueidentifier | INOUT | Research type |
@PROSPECTRESEARCHREQUESTREASONCODEID | uniqueidentifier | INOUT | Request reason |
@REQUESTEDBYID | uniqueidentifier | INOUT | Requested by |
@SUBMITTEDBYID | uniqueidentifier | INOUT | Submitted by |
@NOTES | nvarchar(max) | INOUT | Notes |
@SITES | xml | INOUT | Sites |
@APPUSERGRANTEDRESEARCHGROUPS | bit | INOUT | |
@APPUSERGRANTEDEVENTS | bit | INOUT |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_PRELOAD_PROSPECTRESEARCHREQUEST
(
@CURRENTAPPUSERID uniqueidentifier,
@STATUSCODE tinyint = null output,
@RECORDTYPECODE tinyint = null output,
@CONSTITUENTS xml = null output,
@CONSTITUENTNAMES xml = null output,
@EVENTID uniqueidentifier = null output,
@RESEARCHGROUPID uniqueidentifier = null output,
@PROSPECTRESEARCHREQUESTPRIORITYCODEID uniqueidentifier = null output,
@DUEDATE date = null output,
@PROSPECTRESEARCHREQUESTTYPECODEID uniqueidentifier = null output,
@PROSPECTRESEARCHREQUESTREASONCODEID uniqueidentifier = null output,
@REQUESTEDBYID uniqueidentifier = null output,
@SUBMITTEDBYID uniqueidentifier = null output,
@NOTES nvarchar(max) = null output,
@SITES xml = null output,
@APPUSERGRANTEDRESEARCHGROUPS bit = null output,
@APPUSERGRANTEDEVENTS bit = null output
)
as
set nocount on;
declare @DATALOADED bit;
set @DATALOADED = 0;
declare @CURRENTDATE datetime;
set @CURRENTDATE = getdate();
declare @APPUSERCONSTITUENTID uniqueidentifier;
select @APPUSERCONSTITUENTID = CONSTITUENTID
from dbo.APPUSER
where ID = @CURRENTAPPUSERID;
declare @DEFAULTSITEID uniqueidentifier;
set @DEFAULTSITEID = dbo.UFN_APPUSER_DEFAULTSITEFORUSER(@CURRENTAPPUSERID);
if @DEFAULTSITEID is not null
set @SITES =
(
select
newid() as ID,
@DEFAULTSITEID as SITEID
for xml raw('ITEM'),type,elements,root('SITES'),BINARY BASE64
);
select
@DATALOADED = 1,
@STATUSCODE = 0,
@DUEDATE = dbo.UFN_DATE_GETEARLIESTTIME(dateadd(day, 14, @CURRENTDATE)),
@REQUESTEDBYID = @APPUSERCONSTITUENTID,
@SUBMITTEDBYID = @APPUSERCONSTITUENTID
if dbo.UFN_APPUSER_ISSYSADMIN(@CURRENTAPPUSERID) = 1
begin
set @APPUSERGRANTEDRESEARCHGROUPS = 1;
set @APPUSERGRANTEDEVENTS = 1;
end
else
begin
set @APPUSERGRANTEDRESEARCHGROUPS = dbo.UFN_SECURITY_APPUSER_GRANTED_TASK_IN_SYSTEMROLE(@CURRENTAPPUSERID,'65D6C1D6-E1BB-4EC7-9F29-FE82120E98D3')
set @APPUSERGRANTEDEVENTS = dbo.UFN_SECURITY_APPUSER_GRANTED_SEARCHLIST_IN_SYSTEMROLE(@CURRENTAPPUSERID,'21452A39-7C7D-4334-8B89-6C0EA619ACEC')
end