We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

need help to optimze glideagrregate script for survey trigger

suryakalam
Kilo Contributor

i want to trigger a customer satisfaction servey to every 5th incident caller,when every 5th softwre category incident get resolved,

7 REPLIES 7

Matthew_13
Mega Sage

Hi My Friend,

Yep — thats doable, and your right to be thinking about performance.

If the requirement is send a CSAT survey for ~every 5th resolved Software incident dont use a GlideAggregate(count) on the Incident table at resolve-time. That’s heavy and it can also misfire when multiple incidents resolve at once.

What most people do and I have done instead is a 1-in-5 selection that doesnt require counting at all fast + consistent. You only evaluate it when the ticket transitions to Resolved and if its a “hit,” you trigger the survey.

If you literally need the exact 5th / 10th / 15th in sequence, you’ll want a small counter record not an aggregate on incidents otherwise you’ll run into performance + race conditions.

 

@suryakalam - If help you answer; Please mark Solution Accepted and Thumbs Up

MJG

Thank you Matthew 

If help you answer; please mark Accepted Solution. Kind regrads @suryakalam 

MJG

@suryakalam Your very welcome. If help you answer, Please mark Accepted Solution. I thank you kindly my Friend!

MJG