Email a Link with Parameters, and Have Them Be Interpreted Properly

As always, I searched for this in the forums but I have not found anyone asking the same thing or the answer (yet), so I’m posting in hopes that I can “be that guy” for someone else.

In the past in languages like ASP and PHP (hand-coded), I could create a link like this:

https://survey.fakehelpdesk.com?s=qtwreafsgdjtrnbd

… and email it to a client to request feedback on a survey. When the client would click on the link in their email, index.php on the back end would grab the value of s (usually a _REQUEST[s] would do nicely) and look that survey up in the database to see what help desk ticket it belonged to. Then the form would be personalized to the end user so they are not filling out a survey about “issue B” when really they meant to be filling out a survey for “issue A.”

This gets rather important when the performance of the help desk analyst that worked that ticket and resolved it is being “graded” by their interactions with clients. So imagine that Tom worked Issue B, and Sally worked Issue A, but when the survey results come back, they tell us that Tom was a mean woman. So, we can see that someone filled out the wrong survey. The goal here is to minimize it.

And that’s where the customized ‘s’ parameter comes into play.

In the past I recall I could do some black magic where I would encapsulate the survey ID into something that looked vaguely like:

https://survey.fakehelpdesk.com?scin=s^qtwreafsgdjtrnbdscin

… but I’ve searched my archives and I cannot find my notes on how I did this in the past.

So, is there a way to have scriptcase generate a link with the appropriate parameters already in place in the email? Or, can someone remind me of what the format of the above is so I can replicate the behavior?

I love Scriptcase and have been a licensed user of it since 2012… but sometimes the easiest things from the old days in PHP are immeasurably harder in Scriptcase. So, maybe help an old fossil like me out? :slight_smile:

Thanks!,
-Paul

Responding to my own post, so others have an answer for the future…

With a small nudge in the right direction from Andrew at Scriptcase (Thanks, Andrew!) I found this solution:

<?php
// New Blank Application -> onExecute:
echo sc_make_link("https://www.google.com", ff0000="red";00ff00="green";0000ff="blue");

// Output:
// https://www.google.com&nmgp_parms=ff0000*scin"red"*scout00ff00*scin"green"*scout0000ff*scin"blue"*scout

// Broken out:
	$url  = "https://www.google.com";
	$url .= "?nmgp_parms=";
	$url .= "ff0000*scin\"red\"*";
	$url .= "scout00ff00*scin\"green\"*";
	$url .= "scout0000ff*scin\"blue\"*";
	$url . ="scout";

// A real scriptcase app:
	$url = "http://192.168.111.11/scriptcase/app/fakeproject/sensor_edit";
	$url .= "?nmgp_parms=";
	$url .= "sensor_id*scin1*";
	$url . ="scout";


	// url output = http://192.168.111.11/scriptcase/app/fakeproject/sensor_edit/?nmgp_parms=id*scin1*scout

(Note that the sample above will not actually take you a real query on Google - It’s a proof-of-concept only.)

In the second block you can see where I passed the variable “sensor_id” to it with a value of 1.

Hope this helps!
-Paul

1 Like