I'm using the new Adobe AEM Designer, similar to the Adobe LiveCycle.
I have 2 drop down list: One for District and 1 for County.
District has switch code to populate the 2nd drop down list which is the counties they can select within that district.
I also have a submit button that upon clicking the button, will email the form to the email that's associated with the county that is selected.
I'm not sure how to get the submit button to send the PDF via email based on the email address associated with the county they selected.
Any suggestions are welcome.
Thanks,
KB
Solved! Go to Solution.
Views
Replies
Total Likes
Hey, using the model of the email script from a nearby post you would need something like belows:
var recipient_email = "default_email@this_could_be_empty.too"
var county = this.getField("County").value
if (county == "county_A"){
recipient_email = "info@countyA.net"
}else if(county == "county_B"){
recipient_email = "info@countyB.net"
} //...repeat for every county's email, you can use switch syntax if preferred.
try {
myDoc.mailDoc({
bUI: false,
cTo: recipient_email,
cCC: "Email Addresses",
cSubject: subject,
cMsg: emailBody,
cSubmitAs: "PDF"
});
} catch (e){
app.alert("Email failed")
}
I hope it helps
Views
Replies
Total Likes
Hey, using the model of the email script from a nearby post you would need something like belows:
var recipient_email = "default_email@this_could_be_empty.too"
var county = this.getField("County").value
if (county == "county_A"){
recipient_email = "info@countyA.net"
}else if(county == "county_B"){
recipient_email = "info@countyB.net"
} //...repeat for every county's email, you can use switch syntax if preferred.
try {
myDoc.mailDoc({
bUI: false,
cTo: recipient_email,
cCC: "Email Addresses",
cSubject: subject,
cMsg: emailBody,
cSubmitAs: "PDF"
});
} catch (e){
app.alert("Email failed")
}
I hope it helps
Views
Replies
Total Likes
Thank you sergiy251. I'll try this and let you know how it works.
Views
Replies
Total Likes
Changing "recipient_email" to "am_email", if the am_email is empty or blank use another email, how would I fix this? How doI turn this into a switch? I have 159 counties and a different email for each county. Some will have the first email (am_email) option blank/empty so it will have to go the second email (dsm_email)
var am_email = "default_am_email@this_could_be_empty.too"
var dsm_email = "default_dsm_email@this_could_be_empty.too"
var county = this.getField("County").value
if (county == "county_A"){
(am_email = "info@countyA_am.net") or (am_email = "null")
}else if(dsm_email == "info@countyA_dsm.net"){
}
else if(county == "county_B"){
(am_email = "info@countyA_am.net") or (am_email = "null")
}else if(dsm_email == "info@countyA_dsm.net"){
}
Views
Replies
Total Likes
Switch syntax would look something like below:
switch (this.getField("County").value) {
default:
recipient_email = "default@always.com";
break;
case 'county_a':
var am_email = "info@countyA_am.net"
var dsm_email = "info@countyA_dsm.net"
if (am_email == ""){recipient_email = dsm_email}
else{recipient_email = am_email}
break;
case 'county_b':
var am_email = "info@countyB_am.net"
var dsm_email = "info@countyB_dsm.net"
if (am_email == ""){recipient_email = dsm_email}
else{recipient_email = am_email}
break;
}
Views
Replies
Total Likes
Thank you sergiy2511!!
Views
Replies
Total Likes