Open Site Navigation

Surveys on Catalog Items

Updated: Oct 21, 2021

Recently, I was tasked with allowing users to take a survey on their Catalog Item ordering experience, independent of the Requested Item(s) the Catalog Item generated and capture which Catalog Item the survey was linked to for reporting purposes. The reason for this, is that the organization wanted to gather feedback on the initial ordering process before the RITM has been through the fulfillment process. In my search to find out how to do this, I came across a useful article from ServiceNow and wanted to highlight this feature. My use case is to generate a survey once a user visits a link (or clicks a button) and then associate a record to that survey. Normally, surveys are generated via triggers, so the records themselves come first and generate the survey.

Create a Survey

I created a simple survey for this called Service Catalog Ordering Survey by navigating to Survey > View Surveys and clicking New. You can do this with the Survey Designer as well but I like this interface better. I set the following for easy access:

Pagination setting for Service Portal view: None

One Click Survey: True

Enable Public Access (Related Link): If you allow public users to submit some Catalog Items, if you require a login this isn't necessary.

Then I just created two basic questions and published the survey:

  1. How would you rate your ordering experience? - Numeric scale, but I changed the numbers to text via the Assessment Metric Definitions related list.

  2. Do you have anything you'd like to tell us? - String for input, multiline.

I'm going to go ahead and grab and copy the link I get from the View Survey URL related link and keep it handy because I'll be using it later. You could use this if you wanted, but keep in mind this url takes you to a basic Platform UI view of the survey that looks like this:

The out-of-the-box link is a little dated, and routes to a UI16 view of the survey and can be a disjointed experience if you're launching the survey from the the Service Portal. In my experience, surveys haven't received some love in some time from ServiceNow, though I hope this changes with the Now Experience Framework releases, especially when ServiceNow gets serious about replacing Service Portal.

Create a Widget

For proof of concept I'm going to create a simple button widget and place it on my Catalog Item page. The use case is, I want users to be able to submit feedback about a Catalog Item before they order it. There is an OOTB Feedback button but this is more geared to Customer Satisfaction of the process as a whole, and there are some solutions on Share, but for my purposes I just want to get a little bit of information from the user on the Catalog Item they are currently on. This will open a new tab with the survey so the user doesn't lose any information they may have filled out on the Catalog Item.

Since I'm in my PDI and I'm just doing this to showcase parameters and I want this to look nice I just cloned the SC Catalog Item widget and added my button code in there. Really, this is another up to your instance decision on where to add this. I just added it on top of the cart content for now.


<div class="panel panel-{{::options.color}} b wrapper-md">
    <button tabindex="20" ng-click="generateSurvey()" class="btn btn-info btn-block btn-primary">Catalog Item Feedback</button>

Client controller:

$scope.generateSurvey = function() {
    $"sp?id=public_survey&type_id=6c7e6ed22f6a3810e0374f2e2c99b61d&sysparm_trigger_table=sc_cat_item&sysparm_trigger_id=" + $;

I set this page to public_survey instead of Guest survey to allow non-authenticated users the ability to take it. If a user is logged in, they will be routed to take_survey. This may differ for your organization.

Once I click the button I am directed to my survey and the URL is as such:

Note: I wanted to try and do this in a spModal window but I came across some interesting issues with the parameters that the Take Survey widget takes. For example the triggerId and triggerTable variables both point to options.instance_id or get the data from the URL (which isn't present in an spModal) so in order to work around this with this the options would need to be modified and passed in the spModal call.

Populate the Parameters

I broke this out because it's the important part to all of this and I've only seen one Support article speaking to it in the context of CSM, but it can be used outside of CSM.

You'll see in the code above I am passing the following two parameters to my link:

sysparm_trigger_table = the table the record belongs to, such as sc_catalog_item

sysparm_trigger_id = the sys_id of the record which in my example is the sys_id of the Catalog Item

This is mentioned in the Support article but no example of the link is present and sometimes I need things clearly laid out for me, hence as to why I wrote this post. Looking at the Assessment Instances table, I can now see the survey and it's associated Catalog Item in the Trigger ID field.

This can be used for reporting as well, for example I filtered on my Survey and the 'How would you rate your ordering experience' metric to get the average of the Metric Definition and group by the Trigger ID, i.e. Catalog Item.


Now Support KB: Creating Public Surveys for Consumers

ServiceNow Product Documentation: Surveys in Service Portal

ServiceNow Community: Setting up public surveys in Service Portal

489 views0 comments