Processing LAP Status Changes
Depending on the status that the team is requesting a LAP application be set to (usually moving it back to an earlier state), there may be fields other than the status itself that needs to be changed. The following sections define the scripts to the various changes. The scripts list DO NOT have a safety check in place, so make sure you have the correct information in each variable.
Move to Awaiting Initial Documents
DECLARE @ReviewNum INT = <Review Number>
DECLARE @LMR INT = <Jira ticket number>
UPDATE la
SET
StatusOfApplication = 5,
DatePapersReceived = NULL
FROM
tblLAPApplication la
WHERE
1 = 1
AND la.FormID = @ReviewNum
DECLARE @TrackingID INT = 0
DECLARE @OwnerID INT = (SELECT ApplicationID FROM tblLAPApplication WHERE FormID = @ReviewNum)
DECLARE @Message NVARCHAR(250) = FORMATMESSAGE('Per LMR-%d we have changed the status to Awaiting Initial Documents',@LMR)
EXEC [dbo].[lp_GetNewID] @type = 9, @id = @TrackingID OUTPUT
INSERT INTO [dbo].[tblLAPTracking]
([TrackingID],[OwnerID],[Event],[Document],[RelatedID],[DateSent],[SentVia],[DateReceived],[ReceivedVia],[DateProcessed],[ActionNeeded],[DateActionDue],[InternalRemarks])
VALUES (@TrackingID,@OwnerID,19,0,0,NULL,0,NULL,0,GETDATE(),0,NULL,@Message)
PRINT FORMATMESSAGE('I have updated the information as requested. A note reflecting the change has been added to the application. You will need to generate a new application summary PDF.')