USP_DATAFORMTEMPLATE_CONSTITUENTSITES_EDITSAVE
The save procedure used by the edit dataform template "Constituent Sites Edit Form".
Parameters
| Parameter | Parameter Type | Mode | Description | 
|---|---|---|---|
| @ID | uniqueidentifier | IN | The input ID parameter indicating the ID of the record being edited. | 
| @CURRENTAPPUSERID | uniqueidentifier | IN | Input parameter indicating the ID of the current user. | 
| @CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. | 
| @SITES | xml | IN | Sites | 
Definition
 Copy 
                                    
                    CREATE procedure dbo.USP_DATAFORMTEMPLATE_CONSTITUENTSITES_EDITSAVE 
                    (
                        @ID uniqueidentifier,
                        @CURRENTAPPUSERID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier = null,
                        @SITES xml
                    ) 
                    as
                        set nocount on;
                        if @SITES is null begin 
                            if dbo.UFN_SITEREQUIREDFORUSER(@CURRENTAPPUSERID) = 1 begin
                                raiserror('Site is required.',13,1)
                                return
                            end
                        end
                        exec dbo.USP_CONSTITUENTSITE_VALIDATESITES @SITES;                        
                        if @CHANGEAGENTID is null
                            exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output;
                        declare @NOW datetime;
                        set @NOW = getdate();
                        begin try
                            exec dbo.USP_CONSTITUENT_GETSITES_UPDATEFROMXML @ID, @SITES, @CHANGEAGENTID, @NOW;
                        end try
                        begin catch
                            exec dbo.USP_RAISE_ERROR;
                            return 1;
                        end catch
                        return 0;