Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

subject line based on drop down list

Avatar

Level 1

I just need the "script" to set the subject line of the email from a drop down list. The rules that are setup in Outlook send the form to the correct folder, based on the subject line...

4 Replies

Avatar

Level 5

You could use this script:

By //fill in subject you have to write the path to your dropdown, for example

var SubjectBetreff = Formular1....YourDropDownName.rawValue;

//fill in e-mail
var Mailto = Formular1.s1.email.rawValue;
//var Mailto = "test@test.de";

//fill in subject
var SubjectBetreff = Formular1.s1.betreff.rawValue;
//var Betreff = "Test-Betreff";

//fill in message
var MessageNachricht = "Content PDF:\r" + "Field content: " + Formular1.s1.inhalt.rawValue + "\rName: "
+ Formular1.s1.name.rawValue + "\rDatum: " + Formular1.s1.datum.formattedValue;
//var Nachricht = "This is a test message.\r2.row start here.\r3.row here.";

//fill in e-mail cc
var CC = Formular1.s1.emailcc.rawValue;
//var CC = "testcc@test.de";

//fill in e-mail bcc
var BCC = Formular1.s1.emailbcc.rawValue;
//var BCC = "testbcc@test.de";

var Mail = "mailto:" + Mailto + "?Subject=" + SubjectBetreff + "&Body=" + MessageNachricht + "&cc=" + CC + "&bcc=" + BCC;

//cSubmitAs: "PDF" send the pdf as attachment
//cSubmitAs: "XML" send the pdf as xml-attachment
event.target.submitForm({
cURL: Mail,
bEmpty: true,
cSubmitAs: "XML"
});

You have to use the script above in a normal button and rename as submitbutton.

Hope it will be helpful?

Mandy

Avatar

Level 1

I don't know what you mean about renaming a button from regular to submit. Is this in German?? Have anything in English?? Just not sure what some of the words mean in the example, so I don't know how to mimic. 

This seems like such a simple task and there are so many posts about it...but I cant get them to work.

Any suggestions??

Avatar

Level 8

var emailSubject = yourDropDown.rawValue;

var emailTo = "example@example.com";

event.target.mailDoc({cTo:emailTo, cSubject:emailSubject});

Make sure your form is Reader enabled.

Kyle

Avatar

Level 5

I mean you have to use a normal button from the bject library.

If you use drag and drop the button has the button the default name "Button". Renam this caption in "E-Mail send". This is what I mean.

The naem if you don't understand is only a name for the variable and is an combination from english and german.

Subject is the englis word for Betreff

Message is the english word for Nachricht.

You could use this:

//fill in e-mail

var Mailto = Formular1.s1.email.rawValue;

//var Mailto = "test@test.de";

//fill in subject

var SubjectEmail = Formular1.s1.betreff.rawValue;

//var SubjectEmail = "Test-Subject";

//fill in message

var MessageEmail = "Content PDF:\r" + "Field content: " + Formular1.s1.inhalt.rawValue + "\rName: "

+ Formular1.s1.name.rawValue + "\rDate: " + Formular1.s1.dateEmail.formattedValue;

//var MessageEmail = "This is a test message.\r2.row start here.\r3.row here.";

//fill in e-mail cc

var CC = Formular1.s1.emailcc.rawValue;

//var CC = "testcc@test.de";

//fill in e-mail bcc

var BCC = Formular1.s1.emailbcc.rawValue;

//var BCC = "testbcc@test.de";

var Mail = "mailto:" + Mailto + "?Subject=" + SubjectEmail + "&Body=" + MessageEmail + "&cc=" + CC + "&bcc=" + BCC;

//cSubmitAs: "PDF" send the pdf as attachment

//cSubmitAs: "XML" send the pdf as xml-attachment

event.target.submitForm({

cURL: Mail,

bEmpty: true,

cSubmitAs: "XML"

});

I come from Germany and this is my script (therefore in german) I have try to change the german words in english words...

Helpful?

Mandy