Search Results for 'script'
-
Search Results
-
Hello, Merry christmas to everyone,
I tried to write an script to change the field value based on other fields. I created an script in the form but I cant find which is the problem. Can you help me?function Script_Precio_Y_Grupo(){
var company = record.getFieldValue(‘fld-e1c28abdd3b8451fa38b875818503bc6’);
var grupo = record.getFieldValue(‘fld-6c980123a15646a085389ac4426e07de’);
var precioif (company==”TEST”) {
//Grupo 1
if (grupo=1) {
precio=62
}
//Grupo 2if (grupo=2) {
precio=90
}
//Grupo 3if (grupo=3) {O
precio=125
}//Grupo 4
if (grupo=4) {
precio=157
}//Grupo 5
if (grupo=5) {
precio=250
}}
record.setFieldValue(‘fld-5b32e56f61f34bfb8e9c522f9eb9414a’, precio);
form.saveAllChanges();
}
Script_Precio_Y_Grupo();
I would like to create a CSV file through a form script, as it will be much quicker/more automated than going through the File/Export/Export option.
I have been able to create a script which uses Utils.copyTextToClipboard() to get the data out (and then using the clipboard to insert it into an AppleScript). It appears to work, but was wondering whether it is also possible to write the data to a file rather than the clipboard?
The script as far as I have got with it:
var client_name = record.getFieldValue('fld-ffa7651ff5bd48a9aa8184a69be8550e'); var email = record.getFieldValue('fld-152d99920304499f8f89c3868eb144d1'); var details = record.getFieldValue('fld-23c8168c1deb45bfbcabc862ad6e5199'); var date_prescribed_information_provided = record.getFieldValue('fld-0bf58a5d40b3430f8745b86b2a49775a'); var document_details = record.getFieldValue('fld-b8a4b0731dc94f46abf28eab828abc4e'); var number_of_documents = record.getFieldValue('fld-7ba7df82977945988aac2598dc528a75'); var amount_of_notary_charge = record.getFieldValue('fld-648fee2d0eaa4e7d973fe86bde1d504f'); var what_will_third_parties_be_providing = record.getFieldValue('fld-abfb6ffd2c7c4695972ed54ec463fc08'); var third_party_charge_plus_charge_to_arrange = record.getFieldValue('fld-8cc4031614d7402aa5e131d33ae1c039'); var final_charge = record.getFieldValue('fld-6b86691517dc4b8b8efa63b7da98185d'); var second_individual_client_name = record.getFieldValue('fld-772ee93b5eb747d294e5a9a7b548ebda'); var second_individual_email = record.getFieldValue('fld-d09998df75864a0e8f82b6f61188b537'); // set email for prescribed information document if (second_individual_client_name){ var email_for_prescribed_information = email + " and " + second_individual_email; } else { var email_for_prescribed_information = email; } var date_formatted = date_prescribed_information_provided.toLocaleDateString("en-GB", { year: 'numeric', month: 'long', day: 'numeric' }); var lines = client_name + ";" + email_for_prescribed_information + ";" + details + ";" + date_formatted + ";" + document_details + ";" + number_of_documents + ";" + amount_of_notary_charge + ";" + what_will_third_parties_be_providing + ";" + third_party_charge_plus_charge_to_arrange + ";" + final_charge + ";" + second_individual_client_name + ";" + second_individual_email; // Utils.copyTextToClipboard(JSON.stringify(record.first_name_id)); Utils.copyTextToClipboard(lines);Topic: Help with if statement
I wish to create a script to deal with the following where the document contains two email fields:
1. if only one email field (“email”) has an email address the script assigns to a variable just that email fields contact; but
2. 2. if both email fields (“email” and “econd_individual_email”) have email addresses then the script assigns to a variable the following: “email_field_1 = ” and ” + email_field_2″
using an if statement testing whether another field (second_individual_client_name) contains anything.It works fine when the other field (“second_individual_client_name”) contains data but generates an error when it does not.
The script is as follows:
var client_name = record.getFieldValue('fld-ffa7651ff5bd48a9aa8184a69be8550e'); var email = record.getFieldValue('fld-152d99920304499f8f89c3868eb144d1'); var second_individual_client_name = record.getFieldValue('fld-772ee93b5eb747d294e5a9a7b548ebda'); var second_individual_email = record.getFieldValue('fld-d09998df75864a0e8f82b6f61188b537'); // set email for prescribed information document if (second_individual_client_name.length===0){ var email_for_prescribed_information = email; } else { var email_for_prescribed_information = email + " and " + second_individual_email; } console.log(client_name + "\n" + email_for_prescribed_information);The error message generated is:
New Script: TypeError: undefined is not an object (evaluating 'second_individual_client_name.length'), line:(null)Any help would be gratefully received.
Hi,
to avoid possible data loss I imported all my data as text (unfortunately there is doesn’t seem to be an import log).
Now I converted everything successfully by some scripts.I am just not able to update the creation date using the internal corresponding field type.
Is there a way to keep my original dates ?best
Andreas