Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Conditional email notification

  • jboogie21
  • jboogie21's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
10 years 4 months ago #109674 by jboogie21
Conditional email notification was created by jboogie21
Am I misunderstanding the instructions located here: www.limesurvey.org/manual/Survey_setting..._.26_data_management -
"As of Version 1.92: Enter a valid expression conforming to Expression Manager syntax. This lets you use question code instead of SGQA syntax (for easier readability), plus conditional logic (e.g. route the notifications to different people depending upon the data entered into the survey)."

The way I read this is that I can use Expression Manager syntax to create an email notification based on a user response. Is this not the case? I spent all day today and couldn't make it work...blerg

My particular use case is that I have LS scoring user responses (and it is working the way I want it to!). If a user scores over a certain threshold, I would like a basic notification sent to a staffer to review that users responses.

Can someone please provide some guidance, or tell me I'm missing something...
The topic has been locked.
  • jboogie21
  • jboogie21's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 9 months ago - 9 years 9 months ago #116033 by jboogie21
Replied by jboogie21 on topic Conditional email notification
I finally figured this out with the help from this post

My use case is a little different, but same principles:
  • create hidden equation questions that calculate the scores I want
  • create hidden equation that is condition I want to email on
  • my line of code in this case is:
    Code:
    {if(RDAStotal.value le 47, 'whateveremailaddress', '')}
  • put {questioncode} from the email conditional equation I just created above in the Send basic admin email notification in the settings
  • format basic admin notification email template the way I want (in my case I put the the {questioncode} from the actual calculated score so I know what the actual score is when I get notified.
Last edit: 9 years 9 months ago by jboogie21. Reason: fix hyperlink
The following user(s) said Thank You: polux89
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
9 years 9 months ago #116087 by Mazi
Replied by Mazi on topic Conditional email notification
Thanks for sharing your solution. Please extend the information at our manual (it's a wiki, everyone can and should edit it) if you are missing something there.
It also never hurts to have simple examples at the documentation.

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
More
9 years 7 months ago - 9 years 7 months ago #118690 by polux89
Replied by polux89 on topic Conditional email notification
Hi!

Thanks for your sharing.

The hidden equations questions works perfectly in my case. But I'm stuck with the configuration of the fields "Send basic admin email notification".

When I put the {questioncode} in the field, I did'nt get any notifcation. To verify my equation I simply put the {questioncode} in the text of the notification and put my e-mail adress in the "send basic..." field, results : the "whateveremailaddress" appeard correctly in the text.

Do I need any additional configuration? Do I have really to put only {questioncode} like that :




Or perhaps with a command or a suffix?


Hope someone has a Tipps for me ;)

Thanks.
Last edit: 9 years 7 months ago by polux89.
The topic has been locked.
  • jboogie21
  • jboogie21's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 7 months ago #118693 by jboogie21
Replied by jboogie21 on topic Conditional email notification
It should be {questioncode.shown}. This is so it will populate your notification field with what is shown in your hidden question.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 7 months ago #118697 by holch
Replied by holch on topic Conditional email notification
No, you can't use shown here. Because shown would include basically the item of the question (e.g. "email") instead of the actual email that has been written into the field for the respondents email (which is where the email should be sent, I assume).

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • jboogie21
  • jboogie21's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 7 months ago - 9 years 7 months ago #118703 by jboogie21
Replied by jboogie21 on topic Conditional email notification
Holch I don't quite understand your explanation, as qcode.shown is what I have and when testing it works as desired.

In my case I have a hidden question with a line of code that would display an email address if the condition is met, blank field if not. Then in the notification setting it's that qcode.shown, so if the email is displayed an email is sent if not then no email.

I'm using the notification for admins (thus a static email), not a random user. Might that be what you're suggesting (i.e. wouldn't work for user inputted email addresses?)
Last edit: 9 years 7 months ago by jboogie21. Reason: typing too fast
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 7 months ago #118704 by holch
Replied by holch on topic Conditional email notification
For a text question questioncode.shown is probably the same as as questioncode.

But let's say your question is

Q1. Which of the following would you choose:
1 Item 1
2 Item 2
3 Item 3

Lets assume we choose Item 2 (answer code 2). {Q1.shown) would give us "Item 2", {Q1} would give us "2".

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
More
9 years 7 months ago - 9 years 7 months ago #118709 by polux89
Replied by polux89 on topic Conditional email notification
Thank you both for your help.

Like jboogie21 I use it only for determined admin email. We have six local offices, and I want that the results go directly to the right office.

The respondant has a multiple choice question to select his office, and then my equation "calculates" the correspondant email.

Exemple:

CITY: Please select your office

A city A ---> cityA@asdf.com
B city B ---> cityB@asdf.com
....

Value of {questioncode} is then one single textvalue, for example 'cityB@asdf.ch'

I tried it also with {questioncode.shown} and I didn't get any notification. No idea why...

I found a solution, but it is not very "clean". Instead of making an hidden equation, I put direct the equation {if(CITY_A == 'Y', 'cityA@asdf.com',(if... ))} in the "notification to" field and it works!!!

I really don't understand why with the hidden equation it isn't the case...

If I take a look at the results, the hidden equation works, and the "value" of the email address is right. It seems that limesurvey can't "call" the value when it's time to send the notification...

I'm happy that it works now, but I will prefer a cleaner solution (must give back the survey responsability to other people...).

I'm a bit lost...
Last edit: 9 years 7 months ago by polux89.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 7 months ago #118712 by holch
Replied by holch on topic Conditional email notification
I am not quite sure, but you might have to write the result of the equation actually into a text answer.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
9 years 7 months ago - 9 years 7 months ago #118715 by Mazi
Replied by Mazi on topic Conditional email notification
@polux89:

1. Can you reproduce this issue at our demo ( demo.limesurvey.org/admin )? That always runs the latest version.

2. Does it work fine if you remove the "hidden" flag?

3. If you can reproduce the error at the demo with "hidden" flag set, please file a bug report at our bugtracker.
Thanks!

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Last edit: 9 years 7 months ago by Mazi.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose