UFN_ORGANIZATION_VALIDPARENTCORPID
Validates a constituent's parent organization.
Return
| Return Type |
|---|
| bit |
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @CONSTITUENTID | uniqueidentifier | IN | |
| @PARENTCORPID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_ORGANIZATION_VALIDPARENTCORPID(@CONSTITUENTID uniqueidentifier, @PARENTCORPID uniqueidentifier)
returns bit
with execute as caller
as begin
if @PARENTCORPID is not null begin
-- The parent corporation for a constituent cannot be the record itself
if @PARENTCORPID = @CONSTITUENTID
return 0
-- The parent corporation must be an organization
declare @PARENTCORPISORG tinyint
select @PARENTCORPISORG = ISORGANIZATION from dbo.CONSTITUENT where ID = @PARENTCORPID
if @PARENTCORPISORG = 0
return 0
end
return 1
end