Expand my Community achievements bar.

SOLVED

Variable E-mails in the e-mail button function

Avatar

Level 4

In a form I created, I would like to use the e-mail button, but I have variable e-mails that the form could go to based on how a certain field is populated?  Is there a way to set e-mail button to submit based on how a certain field is populated?  Thanks!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member
12 Replies

Avatar

Former Community Member

Yes ...here is a sample that describes the different ways to send email.

Paul

Avatar

Level 4

After looking at the info you sent, it seems like the third way you had listed (with the fake e-mail button) might be the route I'd want to go.  This is going on the same form I've been working on with populating a field based on a selection in a previous field.  Can I use the same employee name field to trigger who the e-mail should go to, or do I need to use a different one?  Basically what I'm trying to have happen is the Employee name field trigger the e-mail address to be used as the same one that appears in the supervisor line.  I've attached a sample file so you can the form again.  I haven't actually tried putting in the code because I didn't want to mess up what I already had working.  I put in a generic button and re-named it.  (I know that I'll need to move things around so that I don't cover the text.)  Any suggestions would be helpful.  Thanks!

Avatar

Former Community Member

If I understand you right you want to email the form to a different email address based on who the employee is? If so it is simply a case of adding a command to each case in the Switch statement. I added a line of code in the sample provided for the 1st selection.

Paul

Avatar

Level 4

Thanks for the coding help.  That was most of what I'm looking for.  My question now is on the e-mail button and it's settings.  I don't know which "button" to use and then how to set it appropriately to e-mail.  I see there are options on the button to be regular, execute, or submit, and depending on the choice it appears to need something inputted on the Submit tab that appears.  What e-mail address should I put in there since there are multiple ones?  Maybe more generally first, I should use the button field, correct?  And then what setting should go with it to make it work correctly?

Thanks so much!

Avatar

Former Community Member

The button should be a submit button. It doesn't matter what you put in there because

you will override it anyways (but you need to have something). Just like in my example I used test@test.com

Paul

Avatar

Level 4

Ok, so I'm getting even closer, but it's still not working quite right yet.  I think I have the button set correctly, but when I try to send it as a PDF it won't go.  I can if I set it to be something other than a PDF, but then the data's not useful.  Also, the e-mail address I put in just to have it in there like your test one is the one that is actually triggered for the e-mail.  So it's not triggering to send to the appropriate e-mail address yet.  How do I fix this?

Thanks!

Avatar

Former Community Member

To allow Reader to send a PDF you have to Reader Extend the form. You can do this through Acrobat. Under Advanced/Extend Features in Adobe Reader.

For the email address issue, you must have a coding error. If you run the form in Acrobat you can hit the CTrl-J key to open the Javascript console. If there is anything wrong with the script you will see it in there.

Paul

Avatar

Level 4

I tried the things you suggested and I didn't see anything obviously wrong with the coding.  When I did the control + J it didn't even show all the coding.  What I have noticed is that whatever e-mail address I have on the submit field in the object field for the e-mail button is the e-mail that it goes to.  I know it has to have something there for the PDF and the button to work, but is there anyway to override it to the one that's in the script?  Thanks!

Avatar

Former Community Member

Can you post you form so I can have a look when I get a chance?

Paul

Avatar

Level 4

Because it has e-mail addresses and phone numbers in it, I'd rather not put it out here for others to get at?  Is there an alternative way for me to get it to you?

Avatar

Correct answer by
Former Community Member
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----