Conditional email notification

More
3 years 2 months ago #109674 by jboogie21
jboogie21 created the topic: Conditional email notification
Am I misunderstanding the instructions located here: manual.limesurvey.org/Survey_settings#No..._.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...

Please Log in to join the conversation.

More
2 years 7 months ago - 2 years 7 months ago #116033 by jboogie21
jboogie21 replied the 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:
    {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: 2 years 7 months ago by jboogie21. Reason: fix hyperlink
The following user(s) said Thank You: polux89

Please Log in to join the conversation.

More
2 years 7 months ago #116087 by Mazi
Mazi replied the 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
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #118690 by polux89
polux89 replied the 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.
Attachments:
Last Edit: 2 years 4 months ago by polux89.

Please Log in to join the conversation.

More
2 years 4 months ago #118693 by jboogie21
jboogie21 replied the 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.

Please Log in to join the conversation.

More
2 years 4 months ago #118697 by holch
holch replied the 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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #118703 by jboogie21
jboogie21 replied the 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: 2 years 4 months ago by jboogie21. Reason: typing too fast

Please Log in to join the conversation.

More
2 years 4 months ago #118704 by holch
holch replied the 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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #118709 by polux89
polux89 replied the 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 ---> This email address is being protected from spambots. You need JavaScript enabled to view it.
B city B ---> This email address is being protected from spambots. You need JavaScript enabled to view it.
....

Value of {questioncode} is then one single textvalue, for example 'This email address is being protected from spambots. You need JavaScript enabled to view it.'

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', 'This email address is being protected from spambots. You need JavaScript enabled to view it.',(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: 2 years 4 months ago by polux89.

Please Log in to join the conversation.

More
2 years 4 months ago #118712 by holch
holch replied the 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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 4 months ago - 2 years 4 months ago #118715 by Mazi
Mazi replied the 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
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"
Last Edit: 2 years 4 months ago by Mazi.

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now