Search Results for 'script'
-
Search Results
-
I would like help with a Form script concerning a prompt.
The prompt window displays a date field and then 3 further fields:
1. Field 1: to the type of service,
2. Field 2: to choose the number of items, and then
3. Field 3: how to send it itemsIt runs from one form (Notarial Act) and once the fields in the Prompt are populated with data, then the script creates a new record with the data entered in another (Linked to) Form (Disbursements). If all 3 fields are populated, 3 records are created in the Linked to Form.
The script below does this.
However, I would like to be able to amend the script so that if Field 3 is set to ‘none’, then only 2 records are created.
Given the way the prompt script is written/structured, I am not sure how to add this option. Any help would be greatly appreciated.
`
var date_id = ‘fld-7b9283660edc4c818320ec930d427747’;
var type_of_disbursement_id = ‘fld-aad6018d791d477f9c0d323c604712a7’;
var unit_price_id = ‘fld-5dad44183eb04dc38d6c8565e008be25’;
var no_id = ‘fld-27cb8e3b36c7472eb4967ccb45b804d9’;var output = function printOut(continued) {
if (continued == true) {// take date entered in prompt (put into variable date_of_invoice)
// and format so it can be writtenvar vDate_of_invoice_2 = date_of_invoice.replace(/(\d+)\/(\d+)\/(\d+)/, ‘$2\/$1\/$3’);
var vDate_of_invoice_3 = new Date(vDate_of_invoice_2);// var vDate_of_invoice_formatted = vDate_of_invoice_3.toLocaleDateString(‘en-uk’, {year: ‘numeric’, month: ‘2-digit’, day: ‘2-digit’});
// var vDate_of_invoice_formatted_ISO = vDate_of_invoice_formatted.replace(/(\d+)\/(\d+)\/(\d+)/, ‘$3-$2-$1′);if (service_type==’Standard Service’){
var Type_of_Disbursement_variable = ‘FCDO – apostille (standard service)’;
var Type_of_Legalisation_Service_variable = ‘Legalisation agent (standard service)’;} else {
var Type_of_Disbursement_variable = ‘FCDO – apostille (restricted urgent)’;
var Type_of_Legalisation_Service_variable = ‘Legalisation agent (restricted urgent service)’;}
if (service_type==’Standard Service’){
var cost_of_apostille = ’40’;
} else {
var cost_of_apostille = ‘100’;
}
if (service_type==’Standard Service’){
var legalisation_cost = 18 + (18.00 * number_of_apostilles);
} else {
var legalisation_cost = 100;
}
let entries = [{
[date_id]: vDate_of_invoice_3,
[type_of_disbursement_id]: Type_of_Disbursement_variable,
[unit_price_id]: cost_of_apostille,
[no_id]: number_of_apostilles},
{
[date_id]: vDate_of_invoice_3,
[type_of_disbursement_id]: Type_of_Legalisation_Service_variable,
[unit_price_id]: legalisation_cost,
[no_id]: “1”},
{
[date_id]: vDate_of_invoice_3,
[type_of_disbursement_id]: “Courier costs (via legalisation agent)”,
[unit_price_id]: courier_cost,
[no_id]: “1”}
];
for (let entry of entries) {
let newRecord = record.addNewRecordToField(‘fld-7e308c2071e248fba8012dee54b53b97’);
newRecord.setFieldValues(entry);
}
document.saveAllChanges();
} else {
console.log(“Cancel button pressed.”);
}
}var date_of_invoice;
var service_type;
var service_types = [‘Standard Service’,’Restricted Urgent’];
var number_of_apostilles;
var number_of_apostillesx = [‘1′,’2′,’3′,’4′,’5’, ‘7’, ‘8’, ‘9’, ’10’];
var courier_cost;
var courier_costx = [’75’,’none’];let prompter = Prompter.new();
prompter.cancelButtonTitle = ‘Cancel’;
prompter.continueButtonTitle = ‘Go’;
prompter.addParameter(‘Date of invoice: ‘, ‘date_of_invoice’)
.addParameter(‘Type of Service: ‘, ‘service_type’, ‘popup’, service_types)
.addParameter(‘Number of apostilles: ‘, ‘number_of_apostilles’, ‘popup’, number_of_apostillesx)
.addParameter(‘Cost of the courier: ‘, ‘courier_cost’, ‘popup’, courier_costx)
.show(‘Add date, number of apostilles, service and whether sent by courier’, output);`
I’m in the process of refining a document. I’ve added a couple of field scripts to several of the forms. The forms alrady have several hundred records. How do I get the form to run the script on all the existing records besides going through each one and clicking the recalculate formulas circled arrow?
Hello everyone,
i do not understand, what I’m doing wrong.
I just want a simple Promt, that asks for one Value when you hit the bottom.
my script looks like this: var varKurzbeschreibung; var varStrasse; var callbackFunction = function() { console.log(varKurzbeschreibung); console.log(varStrasse); }; let prompter = Prompter.new(); prompter.cancelButtonTitle = 'No Thanks'; prompter.continueButtonTitle = 'Go For It!'; prompter.addParameter('Kurzbeschreibung', 'varKurzbschreibung','text') .show('Neues Haus eingeben', callbackFunction);
When I Start the script, I get the box withe the labels but I can not enter anything. The box for entering is missing,
When I add
.addParameter('Strasse', 'varStrasse', 'popup')
the box is shown, but also a pickup Box, what I do not want,What am I doing wrong?
Thanks
Steve