Relationships: Display Child Incidents associated to a Major Incident on a Problem Record

Josh Pirozzi
Kilo Sage

We're looking for a solution for the following:

 

  • Child Incidents (where applicable) are associated to a Production Impact/Major Incident Record.
  • When the Major Incident has been assessed, and it is necessary, a Problem Record is created from the Major Incident.
  • As there are times when a large number of Child Incidents are associated to a Major Incident (under Related Links), is it possible to auto-populate Child Incidents from a Major Incidents Related Links onto a Problem Records Related Links (in an async/update) when the Problem has been created from a Major Incident?

Thanks for any/all assistance!!

2 ACCEPTED SOLUTIONS

SanjivMeher
Mega Patron

You may need a business rule on the m2m table which links child incident to major incidents, which will also create a record in m2m to link child incidents with problem.

Another option is creating a Relationship record on problem record, so that you dont have to run a business rule.

The relationship records can be created by navigating to System Definition->Relationship. 

In there, you can query all child incidents from incident table associated with the Major incident record.

View solution in original post

Josh Pirozzi
Kilo Sage

Thanks for your notes @SanjivMeher & @AshishKM! I opted for creating a new Relationship to pull the Child Incident record(s) through from the 'First Reported By' Incident. I'll include my Query script below, in the case that anyone else has a similar need.

 

Application: Global

Applies to Table: Problem [problem]

Queries from table: Incident [incident]

 

Query Script:

var parentQuery = 'sys_id='+parent.first_reported_by_task;
var childrenQueryFromParent = 'parentISNOTEMPTY^parent=' + parent.first_reported_by_task;
var childrenQueryFromParentIncident  = 'parent_incidentISNOTEMPTY^parent_incident=' + parent.first_reported_by_task;

/**
  If the 'parent_incident' field is available then
    - use both 'parent' and 'parent_incident' in the query,
    - otherwise just use parent in the query
**/

if (current.isValidField('parent_incident'))
    current.addEncodedQuery(parentQuery + '^NQ' + childrenQueryFromParent + '^NQ' + childrenQueryFromParentIncident);
else
    current.addEncodedQuery(parentQuery + '^NQ' + childrenQueryFromParent);

View solution in original post

3 REPLIES 3

AshishKM
Kilo Patron

Hi @Josh Pirozzi , 

Yes, you can update the existing related list logic to include all child incident(s) along with that incident which is attached with problem record. The same tab with display all incidents.

 

-Thanks,

AshishKM

SanjivMeher
Mega Patron

You may need a business rule on the m2m table which links child incident to major incidents, which will also create a record in m2m to link child incidents with problem.

Another option is creating a Relationship record on problem record, so that you dont have to run a business rule.

The relationship records can be created by navigating to System Definition->Relationship. 

In there, you can query all child incidents from incident table associated with the Major incident record.

Josh Pirozzi
Kilo Sage

Thanks for your notes @SanjivMeher & @AshishKM! I opted for creating a new Relationship to pull the Child Incident record(s) through from the 'First Reported By' Incident. I'll include my Query script below, in the case that anyone else has a similar need.

 

Application: Global

Applies to Table: Problem [problem]

Queries from table: Incident [incident]

 

Query Script:

var parentQuery = 'sys_id='+parent.first_reported_by_task;
var childrenQueryFromParent = 'parentISNOTEMPTY^parent=' + parent.first_reported_by_task;
var childrenQueryFromParentIncident  = 'parent_incidentISNOTEMPTY^parent_incident=' + parent.first_reported_by_task;

/**
  If the 'parent_incident' field is available then
    - use both 'parent' and 'parent_incident' in the query,
    - otherwise just use parent in the query
**/

if (current.isValidField('parent_incident'))
    current.addEncodedQuery(parentQuery + '^NQ' + childrenQueryFromParent + '^NQ' + childrenQueryFromParentIncident);
else
    current.addEncodedQuery(parentQuery + '^NQ' + childrenQueryFromParent);