Problem loading custom attributes in invitations

3 years 11 months ago #94929 by FHemmes

This is my first time using Limesurvey. I am using version 2.00+ (130406).

I am trying to load custom token attributes into my invitation emails, but the attributes sometimes fail to load, or load randomly. Let's say I have a situation like this, where I give each participant two custom attributes denoting a name and a company. (These are not the names of the participants themselves)

Participant 1: [Joe Bloggs] [Tesco]
Participant 2: [John Doe] [Walmart]
Participant 3: [Alice Bobby] [Quantum Solutions]

Now, in my email and in the survey itself, there is a line saying something like this: "You are filling out this questionnaire for [NAME] of [COMPANY]". I use the {TOKEN:ATTRIBUTE_1} and {TOKEN:ATTRIBUTE_2} tags to accomplish this.

My problem is that, in each survey, this is rendered correctly. But in the emails, sometimes I get the right attributes. Sometimes the attributes are not loaded at all. And, more confusingly, sometimes the email for one participant loads with the token attributes of another participant.

Initially I thought it was because there are spaces in the content of each attribute, but that doesn't seem to be a problem for the survey itself. Is there something else that causes Limesurvey to attach no, or the wrong, custom attribute to the invitation emails?

Kind regards,

Please Log in to join the conversation.

3 years 11 months ago - 3 years 11 months ago #94932 by FHemmes
In addition. Some experimenting seems to suggest that for the invitation emails, Limesurvey reads out the custom attributes of the previous token. So keeping with the example in the previous post, Participant 1 would see no name/company in his email. Participant 2 would see "Joe Bloggs of Tesco" and Participant 3 would see "John Doe of Walmart".
However, I'm not sure if this behaviour is consistent across invitations, or if it is just random.

I should perhaps also note that I ran the survey in open access mode, and am now experimenting with closed access to see if this resolves the issue. I assign the tokens using the token generator after I put in all the other participant information.
Last Edit: 3 years 11 months ago by FHemmes.

Please Log in to join the conversation.

3 years 11 months ago #94960 by FHemmes
Okay. I did a test again today and the results were not reassuring.

I took a closed survey, put in all the respondents manually and assigned them a custom token ('test1' through 'test10'), sent them the email and asked them to report back what they get.

None of the 10 test emails I sent out displayed the strings in the custom attributes correctly in the invitation email. All respondents reported seeing the correct strings displayed in the survey.

What annoys me is that I'm convinced this is not technically impossible, because it seems to work some of the time, but not always. I can't, however, figure out what causes the token attributes to not be loaded.

Does anyone know if it is perhaps particular characters, like ' or &, that could cause the problem? I have experimented with a number of those, but they display correctly in the survey texts where they are loaded.

Any thoughts would be welcome.

Please Log in to join the conversation.

3 years 10 months ago #96046 by Pam01
I am having the same problem, sometimes the attributes work and sometimes they don't, did you manage to sort this out.
Thanks Pam

Please Log in to join the conversation.

3 years 10 months ago #96047 by FHemmes
Yep, I eventually figured it out. The solution can be found here:

Basically, in your email you should use the tag {ATTRIBUTE_N} to call your custom attributes, but in your survey itself you should use {TOKEN:ATTRIBUTE_N}.

The only thing I haven't figured out is why in the emails, using {TOKEN:ATTRIBUTE_N} seems to give random results. I would have expected it to either work, or not work at all. Instead, it sometimes didn't insert the attribute for me, sometimes it inserted random one, and sometimes the correct one.

Anyway, that's an academic question now. I've sent out almost a thousand invitations using the {ATTRIBUTE_N} tag, and they've all worked like a charm.

I hope this will help you to solve your problem too.


Please Log in to join the conversation.

3 years 10 months ago #96048 by Pam01
THANK YOU for your quick response and yes a big help, we seem to have it working more or less ok now, which is a big relief! :)

Please Log in to join the conversation.

3 years 10 months ago #96054 by tpartner
FHemmes, if you feel it's warranted, can you please modify that wiki page to reflect this a little more clearly?


Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.