How to auto-populate incident field in incident_task table ?

ujjwal_5181
Tera Contributor

How to auto-populate incident number of incident table to incident field of incident_task table ? 

6 REPLIES 6

Alp Utku
Mega Sage

You can create after business rule on Incident task table. Your business rule should run on Insert and Update

 

Please make sure to check advanced checkbox.

 

 

(function executeRule(current, previous /*null when async*/) {
	
	var nmr = new GlideRecord ('incident'); // Incident Table

      nmr.number   =  current.<incident field of incident task table> ;

      current.update() ;

})(current, previous);

 

 

ujjwal_5181
Tera Contributor

Thank you @Alp Utku  for replying.

It seems without having any query statement It may not return the required record.  

My requirement is to auto-populate incident field of incident_task table. 

You can follow the below attachments.

You are right, you need to add query statement to fetch number from the Incident table

ujjwal_5181
Tera Contributor

Yes, I can write a BR to fetch the number from the incident table, but I want to know how can I use this fetched data on another table like incident_task table. 

I want to set value of incident_task table incident field with the value of its parent table ( i.e incident ) number field.