Tasks Performed by ToApprover

After a Folder_OnMessageCreated or Message_OnChange event occurs in the LitCrit public folder, the Event Service agent instantiates the ToApprover form if the ApprovalRequired field (stored in a hidden field on the form) is equal to 1. CDO commands in the Event Service agent then copy the fields from the EnhancedLitCrit form (see Tasks Performed by EnhancedLitCrit) onto the ToApprover form. The ToApprover form, which now contains the critique, is then sent to the approver, the person specifed in the ApproverEmail field on the AppSettings.asp page in the CML/LitCrit application.

After the administrator clicks Approve or Reject, the script of the ToApprover form uses the Outlook object model to instantiate an EnhancedLitCrit form, as shown in the following code:

Set MyNameSpace = Application.GetNameSpace("MAPI")
Set ReviewFolder = MyNameSpace.GetFolderFromID(UserProperties("FolderID"))
Set MyItem = ReviewFolder.Items.Add("IPM.Post.EnhancedLitCrit")

In the preceding code, the GetNameSpace object of the Outlook object model is used to obtain a MAPI session, which provides access to folders and messages in the information store.

Note  The GetNameSpace object of the Outlook object model is similar to the Session object of CDO. Both objects share a number of methods and properties; for example, the Outlook GetFolderFromID method and the CDO GetFolder method are both used to retrieve folders. Each of these methods requires the same parameters, the FolderID and an optional storeID.

The ToApprover script now uses commands in the Outlook object model to copy all of the fields on the ToApprover form onto the newly instantiated EnhancedLitCrit form. If the administrator has clicked Approve or Reject, the value of the isApproved field on the EnhancedLitCrit form is set to 1 or 0, respectively.

This form now must be posted to the LitCrit public folder. The ToApprover script first finds the location of this folder by reading its folderID from a hidden field (FolderID) on the ToApprover form. Previously, the Event Service agent used EventDetails.FolderID to determine the value of this field and wrote the value to the FolderID field when it copied the values of the original EnhancedLitCrit form onto the ToApprover form.

On Approval or Rejection

This form is now posted to the LitCrit public folder, where it triggers a Folder_OnMessageCreated event. If the critique has been approved, the Event Service agent monitoring the folder updates the FmLib database with information about the approved critique.

If the critique has been rejected, the EnhancedLitCrit form is also posted to the public folder. In this case, the Event Service agent monitoring the folder deletes from the FmLib database all information about the rejected critique. It also deletes the critique itself from the public folder, and sends a message to the reviewer, with the rejected critique attached.