Export Transaction

From ContractPal

Jump to: navigation, search

This tutorial demonstrates how to export the binary content, documents, wizards and audit logs from the transaction. To export a transaction, add a system workflow to the Simple NDA Pal and send the file using an email connection. The export process may require up to 48 hours to complete.

Add Email Connector

Configure Connectors
Enlarge
Configure Connectors

Connectors are created and configured by an Enterprise Administrator.

  1. Add an email data connector called "Email_Export".
  2. Select Email from the Connector Type drop-down list.
  3. Type in the name "Email_Export".
  4. Type in an email address into Email Address under Connector Parameters.
  5. Click the test button.
  6. Check your email account for the test email from ContractPal.
  7. Click Save button.

Import Simple NDA Pal

Modify the Simple NDA Pal to export the transaction.

  1. Complete the Simple NDA Tutorial.
  2. Select ** Developer Activation Key 2 ** from the Activation Key drop down list.
  3. Click the Import button.

User Workflow

Modify the user workflow to start a System Workflow called "Export".

  1. Click user.js in the Workflow folder to open the user workflow.
  2. Type in the workflow script below or copy and paste it into the editor.
  3. Click the Save button.
var c;
var packet;
var page;
var document;
var Data;
var wiz;

function run(controller)
{ 
   c = controller;
   packet = c.getPacket();
   document = packet.addDocument("NDA");
   wiz = packet.addWizard("Client");  
   var email;
   var cName = packet.getProperty("Company");	

// Add the main page, set the macro $display = showWizard. The page will display the wizard.
   page = c.getPage("main");
   page.addWizardToPage(wiz);
   page.setValue("CompanyName", cName);
   
   if (c.isAction("cp-begin") )
  {
     c.getUser().assignRole("Company");
     page.setValue("display", "showWizard");
     page.addWizardToPage(wiz); 
     return page;      
  }
   else if (c.getAction()  == "cp-continue")
  {
      page.setValue("display", "showNDA");                    
      return showDoc("main", "NDA");          
  } 
  else 
  {
       switch (c.getAction())
       {
           case "acceptTerms": 
              c.debug("Document Signed!"); 
              document.sign();
              page.setValue("display", "showNDA");
              return showDoc("main", "NDA"); 
                          
            case "rejectTerms":
              page.setValue("display", "rejectSign");
              return page;              
              
             case "send_email":
             // add the wizard to the packet
               wiz = packet.addWizard("Client");
               
             // Get name and email address from the wizard
               Data = wiz.getData();
               var fName = Data.getValue("firstName");
               var emailAddress = Data.getValue("Email");				

             // Insert first name into the email template
               email = c.createEmail("Invitation");
               email.getData().setValue("first_name", fName); 
               email.getData().setValue("CompanyName", cName);
               email.getData().setValue("email", emailAddress);
			             
            // Send the email to the address entered in the wizard
               email.sendToAddress(emailAddress);
            
            // Notify the user that the email invitation was sent
               page = c.getPage("main");
               page.setValue("display", "confirmation"); 
		page.setValue("firstName", fName);
		page.setValue("email", emailAddress);
               return page;

             case "show_document":  
               c.getUser().assignRole("Recipient");
               // set the macro $display to show the NDA document section of the page.
               page.setValue("display", "showNDA");        
              return showDoc("main", "NDA");  
 	      case "ExportTransaction":
	      var status = c.enableSystemWorkflow();
             page.setValue("display", "ConfirmExport");
             //page.setValue("display", "Confirm Export");				
	      return page;         
             case "Exit":
             return controller.exitToConsole();
     }
   }
}

function showDoc(pageName, docName)
{
  page = c.getPage(pageName);
  document = packet.addDocument(docName);        
  // Add the document to the page
  page.addDocumentToPage(document);

  // set the date in the document
  Data = document.getData(); 
  var todayDate = c.getFormatter().formatDate(c.getDateUtil().createDate(), "dd MMM yyyy"); 
  Data.setValue("date", todayDate);
  //packet.getProperty("Company") 

  page.setValue("CompanyName","WOOT");
  // Get first and last name from the wizard
  Data = wiz.getData();
  var firstName = Data.getValue("firstName");        
  document.enableSigning("acceptTerms", "rejectTerms");       
  return page;
}

Add System Workflow

Add a system workflow started from the user workflow. The system workflow calls the exportPacket method to export the transaction as an XML file. It contains all of the binary content, documents, wizards from the transaction. The file is transferred using a connector Email_Export. The file is delivered as an attachment to an email. The operation is tracked in the Transaction Queue in the Administrative Console.

  1. Create a System Workflow
    1. Type "system" into the Name field.
    2. Select system from the Type drop down list.
    3. Click the default check box.
    4. Click the Create button.
  2. Type in the workflow script below or copy and paste it into the editor.
  3. Click the Save button.
function run(controller)
{
	var thePacket = controller.getPacket();
	var transactionDescription = "NDA User Information";
	var connectorName = "Email_Export";
	
	controller.exportPacket(thePacket, transactionDescription, connectorName);
}

Test Pal

Validate and test the Pal. Click Test in Pal Builder to validate the Pal. Click 'Launch Navigator' in the dialog window to test the Pal using Navigator. Enter responses into the wizard, click on the link in the email, sign the document and click the Export transaction.

  1. Click Image:Test.png Test.
  2. Click the Launch Navigator box: Image:Launch.png.
  3. Enter a first and last name and an email address in the wizard dialog.
  4. Click the Next button.
  5. Click the Exit button.
  6. Open the email and click on the link.
  7. Click sign the NDA document.
  8. Click the Export Transaction button.
  9. Click the Done button.
  10. Click the Exit button.

Learn more about the Transaction Packet.

Transaction Queue

Check the status of a transaction.

  1. Open the Transaction Queue.
  2. Click Image:Details.png to view additional information and job progress:
    • The Transaction Queue lists each transaction by name along with details and status indicators.
  3. Click on Details to open a pop-up window with additional details about the transaction.

Learn More