About the application
The applicationLookupFieldTest comprises of two forms:
- Companies form with fields Company and Address
- Issues form with fields Company (Lookup field), Add new company (checkbox), Add new company to list (checkbox) , Issue (text) and Issue Description. (text)
When a issue is added to the Issues form and the necessary Company name
is not in the lookup field, select the checkbox Add new company, to add the new
company name to the Companies form without leaving the Issues form. The new company name can also be added to the Company dropdown by selecting the checkbox Add new company to list.
Deluge Script
1. Add the following script to the on user input ->Add_new_company block of the Issues form. This script is executed when the checkboxAdd new company is selected. It opens the Companies form as a pop up to add the new company details and also displays the checkbox Add new company to list.
if (input.Add_new_company)
{
hide Add_new_company;
show Add_new_company_to_list;
input.Add_new_company = false;
openUrl("#Form:Companies?abc=0", "Popup Window");
}
2. Add the following script to the on user input ->Add_new_company_to_list block of the Issues form. This script is executed when the checkboxAdd new company to list is selected. It will add the new company name to the Company drop-down of theIssues form.
clear Company;
companies = Companies [ID != 0];
Company:ui.add(companies.Company.getall());
for each comp in Companies sort by Added_Time desc range from 1 to 1
{
input.Company = comp.Company;
}
hide Add_new_company_to_list;
show Add_new_company;
To install the application,