How to get number of the problem and put on incident table?

DIVI1
Tera Expert

Hi, 

I'm not sure how to properly do that.

I want to create autocomplete process for problem_id field on the incident table.

it depends of "first reported by" field on the problem table.

 

So, If "first reported by" (incident number) is same as number of any incident, than "problem_id" field get number of problem from that ticket. 

 

Any Ideas ?

 

Problem table:

DIVI1_0-1680647870240.png

 

 

Incident table:

DIVI1_1-1680647898588.png

 

 

 

1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

Hi @DIVI1 ,

You can create an After - Insert & Update Business rule on problem table, and use the script below in the business rule.

 

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

 

var incGr = new GlideRecord('incident');

incGr.addQuery('sys_id', current.first_reported_by_task);

incGr.query();

 

if(incGr.next()){

  incGr.problem_id = current.sys_id;

  incGr.update();

}

 

})(current, previous);

 

Try this and let me know if you face any issues in this.

 

Thanks,

Anvesh

Thanks,
Anvesh

View solution in original post

1 REPLY 1

AnveshKumar M
Tera Sage
Tera Sage

Hi @DIVI1 ,

You can create an After - Insert & Update Business rule on problem table, and use the script below in the business rule.

 

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

 

var incGr = new GlideRecord('incident');

incGr.addQuery('sys_id', current.first_reported_by_task);

incGr.query();

 

if(incGr.next()){

  incGr.problem_id = current.sys_id;

  incGr.update();

}

 

})(current, previous);

 

Try this and let me know if you face any issues in this.

 

Thanks,

Anvesh

Thanks,
Anvesh