Preventing duplicate entries for Surveys
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2009 03:41 AM
Hi guys,
The requirement is to ensure that a survey cannot be taken twice on the same survey by the same person, thus preventing duplicates in the survey instances.
There is a business rule that queries the survey_instance table, and checks against the taken_by field, and also the Incident number field.
If an entry is found, the operation is meant to abort.
This does not appear to be working correctly. Even with this script, duplicate entries can be created.
The script thats meant to prevent the duplicates looks as follows:
var gr = new GlideRecord("survey_instance");
gr.addQuery("taken_by", current.taken_by);
gr.addQuery("u_task_number", current.u_task_number);
gs.log("taken_by: " + current.taken_by);
gs.log("u_task_number: " + current.u_task_number);
gr.query();
if (gr.next()) {
gs.log("FOUND");
gs.log("You have already submitted a survey for this ticket. Aborting the operation");
current.setAbortAction(true);
}
There is also a script that runs when the instance is created that sets the incident number to the survey instance.
My question is.. When is the preventing script meant to run, so as to not create the instance when an entry is found..
This functionality is very confusing, and really doesnt appear to work.
Please assist where possible.
Thanks
Shaun
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2009 03:42 AM
Thanks for the information.
Out of interest, what currently handles all updates and options for survey_instance and survey_response? Mainly after what drives the inserts into the response table..
is it hardcoded in the background?
Thanks
Shaun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2009 08:50 AM
Yes, it was. You can view the new include script in demo, it's pretty much the same logic that was previously hardcoded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2009 07:13 AM
An easy way to take a risk-free quick look would be to install the plugin in http://demo.service-now.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2012 07:58 AM
Did you find a way to do this - we are on Aspen but it seems whatever I try I cannot get the instance to ignore subsequent duplicate surveys taken by the same person.. It records the additional responses which then invalidates the report data.
I would like it to retain the original responses only for a specific task survey and ignore/abort any attempts at retaking the same survey at a later time.