Can you pass URL params to a survey to auto fill parts of it?

aaronanders
Tera Contributor

I've been asked with finding ways to update an email notification link to a survey to include URL parameters in it that would auto-fill on the survey itself (either from platform view or a portal such as CSM).

AIs are no help here. Some say it's possible, some say it's not, none offer a viable solution or direct answer that I can find.

Has anyone been able to pass params through a URL into a survey before and have it fill out fields on the survey?

3 REPLIES 3

Hi @aaronanders 

 

Try this:

Step1: create a reusable Email Script that builds your custom URL and parameters.

  • Navigate to System Policy > Email > Notification Email Scripts> New.
  • Give it a name (like custom_survey_url_script).
  • Table: asmt_assessment_instance

Sample script:

 

(function runMailScript(current, template, email, email_action, event) {

    var instanceURL = gs.getProperty('glide.servlet.uri');

    var surveyID = current.sys_id;

    var portalSuffix = 'csm';

   

      var surveyLink = instanceURL + portalSuffix + '?id=take_survey&instance_id=' + surveyID;

     surveyLink += '&sysparm_hide_header=true';

    surveyLink += '&sysparm_source=email_notification';

    var linkText = 'Click here to complete your survey';

    var url = '<a href="' + surveyLink + '">' + linkText + '</a>';

    template.print(url);

})(current, template, email, email_action, event);

 

Step 2: Update the Email Notification

  1. Navigate to System Notification > Email > Notifications.
  2. Open your Survey Notification (ensure the table is set to asmt_assessment_instance).
  3. Open the What it will contain tab.
  4. Replace any existing ${URI} or ${mail_script:your_old_script} tags with the new script tag:
    The survey awaits: ${mail_script:custom_survey_url_script}

 

Ankur Bawiskar
Tera Patron

@aaronanders 

not possible unless you update the OOTB assessment_take2 UI page

I won't recommend updating that

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏