Select Page

Search Knowledge Base by Keyword

Insert Data From a Custom List

Goal:

Insert data from columns in a Custom List to TextInputs in a Document or Bundled Documents based on data inserted another TextInput. The script will search your Custom List and will automatically insert the email corresponding to the inserted name.

Instructions:

  1. Create the Template tag EmployeeName and attach this tag to a TextInput in your Template where users will insert name of an employee who will, for example, sign a document on behalf of a company.
  2. Create the Template tag GetEmployeeEmail and attach this tag to a TextInput in your Template where should be a contact email to an employee who will, for example, sign a document on behalf of a company.
  3. Create a Custom List with the name Authorized Employees that will contain two columns: Employee Name and Employee Email.
  4. Insert some data to that Custom List (insert rows).
  5. Insert the below-mentioned script to the EmployeeName tag.

Script Example:

var Tags = LEGITO.documentBuilder.getTagsByName("EmployeeName");

for(var i in Tags){

if(!Tags[i].isSystem()){

var MyTag = Tags[i];

}


}


var str = LEGITO.documentBuilder.event.element.getValue();

var TargetTags = LEGITO.documentBuilder.getTagsByName("GetEmployeeEmail");

var finder = LEGITO.documentBuilder.event.createElementFinder();

var FindEmployeeEmail = finder.findElementsByTagsAuto(TargetTags);

var AuthorizedEmployees = LEGITO.list.getListRecordsByName("Authorized Employees");

for(var i in AuthorizedEmployees){

if(AuthorizedEmployees[i][“employee-name”] == str){

for(var iii in FindEmployeeEmail)

{

FindEmployeeEmail[iii].setValue(AuthorizedEmployees[i][“employee-email”]);

}


}};