Sample Automation Scripts

Classifies a document on the basis of custom attributes

#set($templateDAO = $ContextTool.getBean('TemplateDAO'))

# retrieve the template that will be assigned to the document
#set($privateTemp = $templateDAO.findByName('TaxLienServicing'))

# store the document's path into the variable T_Path
#set($T_Path=$DocTool.getPath($document))

# get a couple of custom attributes from the document
#set($T_NewType=$document.getValue("DT-LegacyWebLT"))
#set($T_ClientName=$document.getValue("ClientName"))

# Now inspect the value of the DT-LegacyWebLT attribute to move the file to the proper folder
#if($T_NewType=="Import")
  $log.info("Reclassify triggered but no new document type selected");
#elseif ($T_NewType=="Payoff Requests Quotes")
  #set ($T_NewFG="Call Center - Payoff Requests Quotes")
  
  # set the correct template and update a custom attribute
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  
  # make the changes persisten into the database
  $DocTool.store($document);
  
  # move to a target folder caclulated dynamically
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');

  # exit the procedure
  #stop
#elseif (($T_NewType=="Lockbox Backup") || ($T_NewType=="2 day letters"))
  #set ($T_NewFG="Payment Processing - Lockbox")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system')
  #stop
#elseif ($T_NewType=="TN Reconciliation")
  #set ($T_NewFG="Payment Processing - Reconciliation")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="TX Loan")
  #set ($T_NewFG="Payment Processing - Texas Loans")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="RIE")
  #set ($T_NewFG="Payment Processing - Received In Error")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Checks")
  #set ($T_NewFG="Payment Processing - Refunds")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Client Reports" ||  $T_NewType=="Reconciliation")
  #set ($T_NewFG="Reporting")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#else 
  $log.info("Not in main $document.fileName");
#end

$log.info("Running 2")
#if ($T_NewType=="Proof of Purchase")  
  #set ($T_NewFG="Custodial - Imports")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Redemption Notice" || $T_NewType=="Verification Request" || $T_NewType=="Redemption Packet" || $T_NewType=="Redemption Affidavit")
  #set ($T_NewFG="Custodial - Redemption Processing")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Lien Release")
  #set ($T_NewFG="Custodial - Release Processing")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Certs-Received, Not Processed" || $T_NewType=="Certs-Stickered and Recorded" || $T_NewType=="Certs-Stickered Only" || $T_NewType=="Deed")
  #set ($T_NewFG="Custodial - Collateral Management")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Assignment Form" || $T_NewType=="List of Property")
  #set ($T_NewFG="Custodial - Lien Assignment Packets")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#else 
  $log.info("Not in Reclassify2 $document.fileName");
#end

$log.info("Running 3")
#if ($T_NewType=="Hello Letters" || $T_NewType=="Goodbye Letters" || $T_NewType=="Demand Letter" || $T_NewType=="Collection Letter" || $T_NewType=="General Collection Letter" || $T_NewType=="Annual Notice" || $T_NewType=="Take Notices" || $T_NewType=="Extension Letter" || $T_NewType=="10 Day Notice")
  #set ($T_NewFG="Asset Management - Noticing")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Notice of Filing" || $T_NewType=="Notice of Hearing" || $T_NewType=="Notice of Discharge" || $T_NewType=="Notice of Dismissal" || $T_NewType=="Proof of Claim" || $T_NewType=="Motion to Lift Stay" || $T_NewType=="Motion to Appoint Trustee" || $T_NewType=="Motion to Dismiss" || $T_NewType=="Debtor's Motion to Extend Exclusive Period"|| $T_NewType=="Disclosure Statement" || $T_NewType=="Confirmed Plan" || $T_NewType=="Reorganization Plan" || $T_NewType=="Objections to Plan")
  #set ($T_NewFG="Asset Management - Bankruptcy")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#elseif ($T_NewType=="Project Status Report")
  #set ($T_NewFG="Project Status Report")
  $document.setTemplate($privateTemp);
  $document.setValue("FunctionalArea","$T_NewFG");
  $DocTool.store($document);
  $DocTool.move($document,"/$T_ClientName/$T_NewFG/",'_system');
  #stop
#else 
  $log.info("Not in Reclassify3 $document.fileName");
#end

This procedure analyzes the document(variable document) and classifies it depending on the value of a custom attribute. The classification implies the update of some metadata and the move to a specific folder calculated dynamically.