In this example, there is an application form, a release form, and attachments. The application will always be first, but the release form is mixed in with the attachments. However, at output, the attachments will only be associated with the release. Therefore, the release form must be routed to another family at Post Extract.
Post Extract is the first scripting phase - we'll do the routing here. Since both the release and the application form have a Social Security Number on them, associating the data off the back end can be done. Routing and deleting an image like this is acceptable when the routed image does not need to carry along any document control information. Since the document control will be with the application only, the solution will work.
GUI Product Features Used in this Script:
Form Family Level Document Control Expression:
{FIRST}<Division []><Department []><Cost Center Number []>
The static literal above, "{FIRST}", is available in the script below, but will not be output at commit. That is what the curly brackets designate.
Key VBScript Features Demonstrated in this Script:
Form.DeleteDocSet: syntax of this method is: Form.DeleteDocSet [ bEntireDocSet, bAttachments, strDeleteDir, strDeleteReason, bOverride ].
"bEntireDocSet" means "Delete the entire doc set" if set to True and "Delete only this image" if set to False.
"bAttachments" means whether or not to delete any attachments to the page in question. True means delete them; false means to not delete them.
"strDeleteDir" is the ability to specify which directory the images would be deleted to. When deleted, the GUI settings under Form Family Management are applied, so they should be set to be the import directory of the family you are routing to.
"strDeleteReason" is the reason the document set or image was deleted.
"bOverride" specifies whether to override the form family level Delete/Reroute setting Don't Allow Image Deletes, Always Delete Entire Document Set. True means to ignore the form family level setting and instead respect the VBScript setting of bEntireDocSet parameter; False means to respect the form family level setting.
Example Script:
'Post Extract Script
strtemp = Form.DocumentControlExpression
If InStr(strTemp, "FIRST") <> 0 Then
Form.DeleteDocSet False, False
End If