Welcome, Guest
Username: Password: Remember me

TOPIC: Pre-population of questions.....

Pre-population of questions..... 2 years 8 months ago #71331

  • rocksalt
  • rocksalt's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
I work for a IT outsourcing company in the UK. We have a custom built PHP driven script linked to our call management system ( Remedy by BMC ) which automatically emails out to select customers, a questionnaire link that facilitates certain questions relating to the helpdesk experience.

Of late, this system is becoming unmanageable, so we’ve looked around and came across Lime survey.
I’ve installed Version 1.91+ Build 11343, set up some survey’s and gotten some general opinions and it’s all good so far.

However I’ve hit a stumbling block that none of the tutorials, workarounds or forum entries seems to expand or mention…..

The current format of the call closure email offers a link for the user to click on that leads them to the survey….. this is generated via a HTML page that is a template embedded to the call notification email sent out upon completion of the call. This template take information from our call logging database ( Oracle ) to extract information like “call reference number”, “customer contact name”, “Site location” and “telephone number” etc…

Trying to get the new survey to work with our existing auto notification e-mails.. the url might looks something like this:

limesurvey.local/index.php?sid=17999&lan...44Xq4=#$$Cust_loc$$#

In order to do this, I must be able to extract information from the notification mail and insert this into the survey….

Dear #$$Contact Name-Main$$#

Asset No #$$Asset No.$$#
Serial No. #$$Serial No.$$#
Customer Ref #$$Customer's Reference$$#
Create Date #$$Create Date$$#
Fault Description #$$Fault Description$$#
Solution #$$Solution$$#

Call #$$Request ID$$# has been Resolved.

We trust that this call has been dealt with to your satisfaction, and would be grateful if you could take a couple of minutes to complete our online Customer Satisfaction Survey:

ENGLISH

FRENCH

POLISH

Czech

I know I can use the language in lime survey so ignore the language options above…. Its just an example of our closure email…. The fields surrounded by # are the data that automatically gets populated by the remedy system.. this is what I would like to use to populate the questions……. Using SGQA maybe ?
I think I need to be able to parse

Customer Ref
Call
And DEAR fields as above.. but im not sure how to do this with limesurvey.

Alternatively… I could drag this information direct from the database, but again, I cannot find any information on how to do this.

Has anyone had any experiences like this ?

Regards

Mark
Last Edit: 2 years 8 months ago by rocksalt.
The administrator has disabled public write access.

Aw: Pre-population of questions..... 2 years 8 months ago #71334

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
Hello,

I think it depends on the requirements you have and if you can wait for further releases or not. One idea might be using the ExpressionManager in the upcomming LimeSurvey 1.92 but I'm not sure if it could handle this (I think TMSWhite can answer this question). Another possible option would be using the URL parameters which should be available in LimeSurvey 2.0.

If you need to have a solution as fast as possible I think these two ways would be possible (and easy done) using LimeSurvey 1.91+.

1. Using Javascript within your design template
Go to the Template editor. If you are using a standard design template you can copy it and change the elements shown on different pages. If the mentionded text is used on the welcome page that would be the Screen "Welcome page" and the standard file(s) "welcome.pstpl". There you can edit the message the way you want and even add some Javascript that reads the parameters from the URL, extracts them and write them into the page. I think you could either do it by writing the whole message with javascript or using the template.js file to manipulate the container containing the welcome message.

2. Using Javascript within your welcome page in the survey options
If you want to do it this way you have to disable the "Filter HTML for XSS" option in the "Security" tab of the "Global settings". Then you can use Javascript inside your survey. So you can edit the text element(s) "Welcome message" and add some Javascript that does the same mentioned in point 1.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.

Re: Aw: Pre-population of questions..... 2 years 8 months ago #71336

  • rocksalt
  • rocksalt's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
cool. Thanks for your response.
I think option 1 has a lot of merit, ill have to look into this, java not being my strong suit here... but i might be able to find a script that can pull the information via ODBC from the DB and then present it to LS, but how can i get it to know what to look for in the first place? it must be able to read something.. maybe in the URL? and then parse that to a query that will then use it to pull the data from the DB ?
The administrator has disabled public write access.

Re: Aw: Pre-population of questions..... 2 years 8 months ago #71339

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
Given a URL something like:
limesurvey.local/index.php?sid=17999&lang=en&6X44X11=ContactNameMain&6X44X22=AssetNo&6X44X33=SerialNo&6X44X44=CustomerReference&6X44X55=CreateDate&6X44X66=FaultDescription&6X44X77=Solution&6X44X88=RequestID

You could hve HTML something like this in the welcome message:
Dear <span class="contactName">&nbsp</span><br />
<br />
Asset No <span class="assetNumber">&nbsp;</span><br />
Serial No. <span class="serialNumber">&nbsp;</span><br />
Customer Ref <span class="contactName">&nbsp;</span><br />
Create Date <span class="createDate">&nbsp;</span><br />
Fault Description <span class="faultDescription">&nbsp;</span><br />
Solution <span class="solution">&nbsp;</span><br />
<br />
Call <span class="RequestID">&nbsp;</span> has been Resolved.

And then a script like this will grab the URL parameters and populate the <span> elements in the welcome message:
<script type="text/javascript" charset="utf-8">
 
	function getURLParameter(name) {
		return decodeURI(
			(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
		);
	}
 
	$(document).ready(function() {
		$('.contactName').text(getURLParameter('6X44X11'));
		$('.assetNumber').text(getURLParameter('6X44X22'));
		$('.serialNumber').text(getURLParameter('6X44X33'));
		$('.contactName').text(getURLParameter('6X44X44'));
		$('.createDate').text(getURLParameter('6X44X55'));
		$('.faultDescription').text(getURLParameter('6X44X66'));
		$('.solution').text(getURLParameter('6X44X77'));
		$('.RequestID').text(getURLParameter('6X44X88'));
	});
 
</script>
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: Steve, rocksalt

Aw: Pre-population of questions..... 2 years 8 months ago #71343

  • Steve
  • Steve's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 494
  • Thank you received: 46
  • Karma: 17
Hello,

sorry if I missunderstood but do you have an URL like
limesurvey.local/index.php?sid=17999&lang=en&6X44X11=ContactNameMain&6X44X22=AssetNo&6X44X33=SerialNo&6X44X44=CustomerReference&6X44X55=CreateDate&6X44X66=FaultDescription&6X44X77=Solution&6X44X88=RequestID
or do you have to create this URL yourself?

If you allready have this kind of URL you can use the sollution provided by tpartner, you don't have to get any information from the oracle database in LimeSurvey because you allready have the information in your URL parameters.

@tpartner:
There is a copy/paste error in your scripts
Customer Ref <span class="contactName">&nbsp;</span><br />
should be something like
Customer Ref <span class="customerRef">&nbsp;</span><br />
and
$('.contactName').text(getURLParameter('6X44X44'));
has to be changed to
$('.customerRef').text(getURLParameter('6X44X44'));
.

If you only need the information from the URL on the welcome page and you don't use the SGQA code to prefill an answer of question X you don't have to use the SGQA. You can used parameters that are easier/more easy to read. For example
limesurvey.local/index.php?sid=17999&lang=en&conName=ContactNameMain&assNo=AssetNo&serNo=SerialNo&cusRef=CustomerReference&creDa=CreateDate&desc=FaultDescription&sol=Solution&reqID=RequestID
and change it in both the HTML and Javascript code. But as said before it depends on what you want to do.
Mit freundlichen Grüßen/Best regards,

Stefan Gohlke
LimeSurvey Team
The administrator has disabled public write access.
The following user(s) said Thank You: rocksalt

Re: Aw: Pre-population of questions..... 2 years 8 months ago #71344

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4207
  • Thank you received: 791
  • Karma: 360
Oops, thanks for the catch vierundzwanzig.
Dear <span class="contactName">&nbsp</span><br />
<br />
Asset No <span class="assetNumber">&nbsp;</span><br />
Serial No. <span class="serialNumber">&nbsp;</span><br />
Customer Ref <span class="customerRef">&nbsp;</span><br />
Create Date <span class="createDate">&nbsp;</span><br />
Fault Description <span class="faultDescription">&nbsp;</span><br />
Solution <span class="solution">&nbsp;</span><br />
<br />
Call <span class="RequestID">&nbsp;</span> has been Resolved.
<script type="text/javascript" charset="utf-8">
 
	function getURLParameter(name) {
		return decodeURI(
			(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1]
		);
	}
 
	$(document).ready(function() {
		$('.contactName').text(getURLParameter('6X44X11'));
		$('.assetNumber').text(getURLParameter('6X44X22'));
		$('.serialNumber').text(getURLParameter('6X44X33'));
		$('.customerRef').text(getURLParameter('6X44X44'));
		$('.createDate').text(getURLParameter('6X44X55'));
		$('.faultDescription').text(getURLParameter('6X44X66'));
		$('.solution').text(getURLParameter('6X44X77'));
		$('.RequestID').text(getURLParameter('6X44X88'));
	});
 
</script>
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: rocksalt

Re: Aw: Pre-population of questions..... 2 years 8 months ago #71345

  • rocksalt
  • rocksalt's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
Typically i'd have a LS questionnaire...

limesurvey.local/index.php?sid=17999&lang=en

then i would ( still have to investigate this bit ) tack on to the end the extra information to pre populate the fields..... im not sure if remedy can do this, this i have to figure out if it's dynamic enough to do.
If not, i thought maybe using a token... our remedy system uses a ref number like 1316379 so i could have that as a token, however, as a call is generated, acted upon and then closed... this is the part im going to have trouble with... linking that final act of a closure e-mail to LS in order for it to pick up the data and fill it out. the email the user gets, is already populated with the data i need to extract and use to pre populate the LS fields, but i can't see an obvious way to marry the two together.

Can LS run on like a cron job system? and automatically send invites based upon parsing a csv or txt file ? it seems a complicated approach though so might not bother with that.

I think i could probably convince the power that be that this is now going to have a manual element to the process in that the user must ( mandatory ) fill out name, call ref, location and phone number, but i think we'd see a drop in actual responses as the users would just not bother if it was perceived as time consuming.
vierundzwanzig wrote:
Hello,

sorry if I missunderstood but do you have an URL like
limesurvey.local/index.php?sid=17999&lang=en&6X44X11=ContactNameMain&6X44X22=AssetNo&6X44X33=SerialNo&6X44X44=CustomerReference&6X44X55=CreateDate&6X44X66=FaultDescription&6X44X77=Solution&6X44X88=RequestID
or do you have to create this URL yourself?

If you allready have this kind of URL you can use the sollution provided by tpartner, you don't have to get any information from the oracle database in LimeSurvey because you allready have the information in your URL parameters.

@tpartner:
There is a copy/paste error in your scripts
Customer Ref <span class="contactName">&nbsp;</span><br />
should be something like
Customer Ref <span class="customerRef">&nbsp;</span><br />
and
$('.contactName').text(getURLParameter('6X44X44'));
has to be changed to
$('.customerRef').text(getURLParameter('6X44X44'));
.

If you only need the information from the URL on the welcome page and you don't use the <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a> code to prefill an answer of question X you don't have to use the <a href='www.docs.limesurvey.org/tiki-index.php?p...tions+for+LimeSurvey'>SGQA</a>. You can used parameters that are easier/more easy to read. For example
limesurvey.local/index.php?sid=17999&lang=en&conName=ContactNameMain&assNo=AssetNo&serNo=SerialNo&cusRef=CustomerReference&creDa=CreateDate&desc=FaultDescription&sol=Solution&reqID=RequestID
and change it in both the HTML and Javascript code. But as said before it depends on what you want to do.
The administrator has disabled public write access.

Re: Aw: Pre-population of questions..... 2 years 8 months ago #71346

  • rocksalt
  • rocksalt's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
i've done some testing and i can get two variables included in the auto mail

survey.local/csq_forms/form1.php?call_re...00001318529&name=Tom Parker


so the url they click to start the survey as above can indeed have SGQA used to parse the two fields from the url into the survey like:

limesurvey.local/index.php?sid=17999&lang=en&6X44X88=RequestID=000000001318529&6X44X11=ContactNameMain=Tom Parker

does that make sense ?
The administrator has disabled public write access.

Re: Pre-population of questions..... 2 years 8 months ago #71347

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
rocksalt-

1.92 with Expression Manager is supposed to support those URL parameters, but I haven't had any test cases with which to confirm that yet.

Brainstorming, another option might be to use tokens and token attributes. If you have the ability to insert data into the token table attached to the survey, you could then use normal replacements functions (INSERTANS:SGQA in 1.91+, or Expression Manager's approach in 1.92) to customize your emails and survey. That would avoid the need to send potentially identifiable information in the URL GET string (since by passing the token alone, LimeSurvey would have access to the other attributes stored in the database).

In order to take that approach, you'd either need the ability to write to the token_SID table directly, or use an API.

LimeSurvey Gurus - do we have an API for writing to the tokens table like this?

/Tom
The administrator has disabled public write access.

Re: Pre-population of questions..... 2 years 8 months ago #71361

  • rocksalt
  • rocksalt's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 14
  • Karma: 0
i tried using the SCGA path...

limesurvey.local/index.php?sid=51679&51679X8X48XQ1=Y

simple yes no radio button choice.....

does not work...

tried with survey active, and is not anonymous...i think there's something else here, but seeing as this is my first attempts with a scga i probably have done something wrong somewhere
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.185 seconds
Donation Image