Copy link to clipboard
Copied
Todays call for help please
I have seperate fields for Installation Postcode, Installation City, Billing Postcode and Billing City.
I need to merge the installation postcode and city and pull that into a different field, BUT if there is something in the Billing Postcode and City, it needs to merge and pull those details instead.
I've worked out how to merge the fields and I can pull either the postcode or the city across, but I can't for the life of me work out how to get it to do everything at once!
These are the variables
var BillingPC = this.getField("Master.ACCOUNT_BILLINGPOSTALCODE").valueAsString;
var BillingCity = this.getField("Master.ACCOUNT_BILLINGCITY").valueAsString;
var InstalPC = this.getField("installation post code").valueAsString;
var InstalCity = this.getField("installation city").valueAsString;
Can anyone show me how to do this. Thank you
Copy link to clipboard
Copied
Place this script as a calculation script in the field that hold the merged data:
var str1 = "";
var str2 = "";
var BillingPC = this.getField("Master.ACCOUNT_BILLINGPOSTALCODE");
var BillingCity = this.getField("Master.ACCOUNT_BILLINGCITY");
var InstalPC = this.getField("installation post code");
var InstalCity = this.getField("installation city");
if (BillingPC.value != BillingPC.defaultValue) {str1 = BillingPC.value;}
else {str1 = InstalPC.value;}
if (BillingCity.value != BillingCity.defaultValue) {str2 = BillingCity.value;}
else {str2 = InstalCity.value;}
event.target.value = str1 + " " + str2;
Copy link to clipboard
Copied
Place this script as a calculation script in the field that hold the merged data:
var str1 = "";
var str2 = "";
var BillingPC = this.getField("Master.ACCOUNT_BILLINGPOSTALCODE");
var BillingCity = this.getField("Master.ACCOUNT_BILLINGCITY");
var InstalPC = this.getField("installation post code");
var InstalCity = this.getField("installation city");
if (BillingPC.value != BillingPC.defaultValue) {str1 = BillingPC.value;}
else {str1 = InstalPC.value;}
if (BillingCity.value != BillingCity.defaultValue) {str2 = BillingCity.value;}
else {str2 = InstalCity.value;}
event.target.value = str1 + " " + str2;
Copy link to clipboard
Copied
Perfect, thank you so much @JR Boulay
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more