Display the parent incident number on the child incident with hyperlink to the parent incident

Madhu5
Tera Contributor

Hi All,

I have a scenario where when there are child incidents associated with a parent incident.When teh child incident is opened,a message should be displayed "There is a parent incident INCXXX" Incident number should be a hyperlink and onclick it should open the incident on new tab.

Please suggest on how to achieve this

1 ACCEPTED SOLUTION

Michael Jones -
Giga Sage

You can do this with an Display business rule, with a condition of parent incident "is not empty" and a script like this: 

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

    var link = '<a href="/' + current.parent_incident.getRefRecord().getLink() + '">' + current.parent_incident.number + '</a>';
    var message = 'There is a parent incident ' + link;
    gs.addInfoMessage(message);

})(current, previous);

 

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

View solution in original post

2 REPLIES 2

Michael Jones -
Giga Sage

You can do this with an Display business rule, with a condition of parent incident "is not empty" and a script like this: 

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

    var link = '<a href="/' + current.parent_incident.getRefRecord().getLink() + '">' + current.parent_incident.number + '</a>';
    var message = 'There is a parent incident ' + link;
    gs.addInfoMessage(message);

})(current, previous);

 

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Michael Jones -
Giga Sage

Sorry, minor edit - forgot to set the target in the link to open in a new tab. 

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

    var link = '<a href="/' + current.parent_incident.getRefRecord().getLink() + '" target="_blank">' + current.parent_incident.number + '</a>';
    var message = 'There is a parent incident ' + link;
    gs.addInfoMessage(message);

})(current, previous);

I hope this helps!

If this was helpful, or correct, please be kind and mark the answer appropriately.

Michael Jones - Proud member of the GlideFast Consulting Team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!