Selective Surveys

Hi all,

I’ve had a look via search but couldn’t find anything similar so hoping someone can help or even better has already created something similar.

I’m looking to send out surveys to Customers after their case has been completed to be able to collect some Customer satisfaction data. Some categories we will be looking to do that on every case being closed which is nice and simple however on some I was hoping to do it more randomly rather than all. Is there a way to use the case reference number or record ID to facilitate this, ie. every uneven number/case or records ending in a 5 for example?

Thanks in advance


I’ve done similar before. I created a composite looking at the right digit of the id. I then created a subset where this digit = 0 → if the right digit =0 send survey (that will give 10% sample), if right digit = 0 or 5 will give a 20% sample etc.

1 Like

Thanks Kevin, sounds like my thought process wasn’t a million miles off. I’ll give that a try

1 Like

Morning Gary,

The way I often approach this is with an Event Action.
I set up a rule to fire the event action whenever an activity occurs that I want to respond to.
The event action takes a parameter ‘percentage’, which allows me to set an integer value between 1 and 100, either as text in the rule definition or by passing in a variable.

I need only then create a reference to the event I want to fire, i.e. Send Survey and reference that in the code below.

Set debug = False to silence console logging.

debug = true;

//Load IM Percentage

if (debug) cs.log('****************START OF >>>> Fire Event On Percentage****************')

if (debug) cs.log(params);

im_percentage = params.custom.percentage;

if (debug) cs.log('IM Percentage : ' + im_percentage+'%')

im_random = Math.floor(Math.random() * 100) + 1;

if (debug) cs.log('IM Random : ' + im_random);

fire = im_percentage >= im_random;

if (fire) {

if (debug) cs.log('Firing Event Action');

cs.​​fire_event(cs.ref("event_reference"), 'Rolled: ' + im_random);

} else {

if (debug) cs.log('Skipping Event Action');


if (debug) cs.log('****************END OF >>>> Fire Event On Percentage****************')

Thanks very much Adam, super useful to be able to set the value like that