How to get populate "incident" creation date on "incident_task" one date/time field.

sinu2
Tera Expert

HI all,

I am getting struck with populating "incident" cretion date/time in to another table "incident_task" 

for this i have written after BR .Please find the below script

 

@I have checked that gs.log('incident creation date:' +current.sys_created_on); in this log current.sys_created_on is not comming on logs

(function executeRule(current, previous /*null when async*/) {

current.sys_created_on = current.u_original_date;
gs.log('incident creation date:' +current.sys_created_on);
var inc_dte = new GlideRecord('incident_task');
inc_dte.addQuery('incident',current.sys_id);
inc_dte.query();
gs.log('incident records match:' +current.sys_id);
if(inc_dte.next()){

current.u_original_date = inc_dte.u_original_date;
gs.log('incident original date:' +inc_dte.u_original_date);
inc_dte.update();

}

})(current, previous);

 

Can anyone help on this

9 REPLIES 9

Hi Varsha i have kept my BR both Insert and update

asifnoor
Kilo Patron

1. check if the incident in the incident task exists during create or update?

2. if its on create, then ensure your BR is afer insert. otherwise, have it after update.

Before BR does not work here.

Hi Asif,

Please find the below screen shot. And i have checked in the Incident_task table the incident field is populating as single digit number

find_real_file.png

and is this BR created on incident_task table?

 

That could be the problem of your query not matching.

Kindly check first why incident task is not getting the correct incident number there.