How to resolve getEventTarget() error?

Raju Koyagura
Tera Guru

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.

14 REPLIES 14

Namrata,



    Try this scheduled 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 evaluator = new GlideScopedEvaluator();


  evaluator.putVariable('problem_task.reminder', 'problem_task.reminder');


  evaluator.putVariable('problemTask', 'problem_task');


  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);


  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 ");


  }


  }


}


NamrataJain
Tera Expert

Hi Abhinay,



Thanks for all the help , the error has gone , but it is still not triggering the notification , all the logs are coming as expected.



But the email event has not been triggered.



Best Regards,


Namrata Jain


There is still a problem with your script include. But you should now see the event triggered in the event log. I do not want to overlap this thread. Please create a new thread, I will respond to that thread, so that people having same issues can find the answer easily.


NamrataJain
Tera Expert

Sure ...


Did you happen to create another thread? Did your issue resolve?