[Solved] Update another survey when using active sguid (enterprise edition)




I’ve created a gateway survey which asks for user information, this then URL redirects to the main survey using this information as well as generating an sguid. This survey then contains links to different quizzes and the current score for each. 

When they click on a quiz it URL redirects to that quiz with the same sguid. User takes the quiz and it URL redirects back to the main survey. However, I want to update the top score from the quiz but because it’s using an sguid it doesn’t seem possible. The main survey only shows what the user last left with, and not with any new or different information in the URL. 

Is there a way around this or would I have to not use an sguid and send all the information from the gateway to the main survey, to a quiz and then back to the main survey? That would end up being a very long URL. 

Any advice on how to get around the sguid problem would be appreciated, 


Paul Clarkson378376 asked

    Best answer


    Hi Paul!

    Unless you are using Custom Scripting, I imagine you are capturing the value of your URL variables using a merge code somehow (whether that merge code is in the “default answer” of a textbox question, or has been placed in a Hidden Value action). If that is correct, the trouble here is that merge codes are only evaluated once – after that, they are replaced with static text that doesn’t get changed again on future page loads.

    With that in mind, there are only a few options – one pedantic solution would be to create many identical pages in your main survey, and jump to the next page (using __sgtarget maybe) after each quiz (treating each page as “one-time use”). The logistics to implement this would most likely be a nightmare, however, so I wouldn’t actually recommend this.

    The other solution, as hinted earlier, involves Custom Scripting. A Custom Script will run every time a page is loaded, so if you “grab” the URL variable (sgapiURLValue) and store it (sgapiSetValue) using a Custom Script instead of merge codes, you will be able to update these values later. Here’s a short example that might do something like this:

    %%urlVariableName = “quiz1score”; // this is the name of the URL variable you want to capture

    %%hiddenFieldId = 2; // this is the question ID where you are storing this value

    %%newValue = sgapiURLValue(%%urlVariableName);

    // this if statement will only set the new value if a URL variable was passed in

    if (%%newValue !== “”) {

    sgapiSetValue(%%hiddenFieldId, %%newValue);


    Custom Scripting is not something our Support team is able to help troubleshoot, but Community users are awesome so it’s my pleasure to provide this example/starting point! I hope this helps 🙂

    Nathan - Survey Astronaut answered


      Question stats

      • Active
      • Views2852 times
      • Answers1 answer
      • Followers0 followers