How to resolve getEventTarget() error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2015 11:25 PM
Hi Everyone,
I have created a custom table, which extending from 'Task' table. When I try to insert a record in that new table, I am getting below error.
"getEventTarget() called with invalid record reference: XXXX.dccecf982bbd3100897d1c9069da15d0 for event: XXX, could have been deleted."
If I tried to create a record manually, then its showing "java.sql.BatchUpdateException: Duplicate entry".
I gone through this link 'getEventTarget() (solved!)' but I am not clear with the solution. Could you please anyone, help me in this.
Regards,
Raju.
- Labels:
-
Integrations
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2016 02:32 PM
Hi Abhinay,
I am calling this script include into a script type of field.
var AutoNotification= Class.create();
AutoNotification.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize : function() {
},
AutoNotification : function(eventName,targetRecord){
gs.log("manu inside the include script today:");
// var test = "\""+eventName+"\"";
var test1 = eventName;
var targetRecord1 = targetRecord;
gs.eventQueue(test1, targetRecord1, targetTable1.assigned_to, targetTable1.assigned_to.getDisplayValue());
return false;
},
type : "AutoNotification"
});
Here is the code for script type of field :
var gr = new AutoNotification();
gr.AutoNotification("problem_task.reminder",'problem_task');
and this field is then called in the scheduled job.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2016 03:34 PM
Namrata,
In the gs.eventQueue(), 2nd parameter should be a glide record object, but in your case you are just passing table name. In your script include where is targetTable1 defined? Is the script field on problem_task table? And what are you trying to achieve from the scheduled Job?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2016 03:53 PM
Hi Abhinay,
I am trying to configure gs.eventQueue in the script include which will be called in the script type of field and this field will be called in the scheduled job.
Unfortunately I am getting error as
getEventTarget() called with invalid table name: problemTask for event: problem_task.reminder |
I know since I am calling script include from the script field , it is not triggering event , but then in the script field I am passing all the necessary parameters in this script field and this field is evaluated in the scheduled job, so logically speaking it should work.
The reason for doing this is we are trying to make sure that in future if we need similar kind of job , we need create more , the same can be used.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2016 03:59 PM
Namrata,
Please answer the following questions, so that I can help you more efficiently..
1) Is you script field on problem_task table?
2) I see in your script include a variable called targetTable1 which is not defined? Where is it defined?
3) can you post your scheduled job here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2016 04:03 PM
Hi Abhinay,
Here is the schedule Job :
checkForProblemReminder();
function checkForProblemReminder() {
var companyTrigger = new GlideRecord('u_company_trigger');
companyTrigger.addQuery('u_trigger_type','43e307d91398a6009c2071522244b0c5');
companyTrigger.query();
// gs.log("Count of manu: "+companyTrigger.getRowCount());
while(companyTrigger.next()){
//gs.info(evaluator.evaluateScript(companyTrigger, 'u_trigger_script', null));
//gs.log("Manu please work this script: ");
var conditionTable = companyTrigger.u_condition_table;
var conditionQuery = companyTrigger.u_condition;
//gs.log("manu : "+conditionTable);
//gs.log("manu: "+conditionQuery);
// gs.log("manu script : "+triggerScript);
// var evaluator = new GlideScopedEvaluator();
var problemTask = new GlideRecord(conditionTable);
problemTask.addEncodedQuery(conditionQuery);
problemTask.query();
//gs.log("Manu today : "+problemTask.getRowCount());
while(problemTask.next()){
var triggerScript = companyTrigger.u_trigger_script;
// evaluator.evaluateScript(problemTask, triggerScript, null);
//gs.info(evaluator.evaluateString(triggerScript));
// evaluator.evaluateScript(problemTask, triggerScript, '');
// var test1 = evaluator.evaluateScript(problemTask, companyTrigger.u_trigger_script, '');
// gs.eventQueue("problem_task.reminder", problemTask, problemTask.assigned_to, problemTask.assigned_to.getDisplayValue());
// gs.log("manu : Manu: end of while");
// GlideEvaluator.evaluateString("gs.print(test + ' World');");
Packages.com.glide.script.Evaluator.evaluateString(triggerScript);
gs.log("manu inside while today ");
}
}
}
here is the snapshot of the company trigger table where I have the script field type:
Thanks.
Best Regards,
Namrata Jain