Incident Form Header: "This Incident Is Linked To Problem: XXXXX [STATUS]"

IT MonkeyIT Monkey O.G.
edited February 26 in Cireson Uploads
Customization by @john_doyle that support have recently implemented on the Cireson Support Portal.

Helps quickly see if the IR is linked to a PR and its status:



Tested on v7.4

//Add Problem Link to the top of the IR form 
app.custom.formTasks.add('Incident', null, function(formObj, viewModel){  
      formObj.boundReady(function () {
            if (typeof viewModel.RelatesToWorkItem[0] != 'undefined' && viewModel.RelatesToWorkItem[0].ClassName == 'System.WorkItem.Problem')
			{
				$("#parent-header-space").append("<div><div class='parent-header-link'><label>This incident is linked to problem</label> : <a data-bind='attr: { href: view.controller.editHref}, text: view.controller.editLink' target='_blank' href='/Problem/Edit/" + viewModel.RelatesToWorkItem[0].Id +"/'>" +viewModel.RelatesToWorkItem[0].Id + "</a>&nbsp;<span class='label label-info label-heading'>" + viewModel.RelatesToWorkItem[0].Status.Name + "</span></div></div>");
            };
      });
}); 

Comments

  • Leigh_KildayLeigh_Kilday Member Advanced IT Monkey ✭✭✭
    edited February 27
    This is rather rad. I've implemented it in our environment and have had no issues so far.

    I tried altering the script to apply to CRs and RRs, but it doesn't show up. Could this be because a CR doesn't have a parent/child function and the #parent-header-space doesn't exist in the CR form?

    Edit: @john_doyle
  • Brian_WiestBrian_Wiest Customer Advanced IT Monkey ✭✭✭
    Guess we have to wait until 7.4. My 7.3 returns undefined on the linked problem status.
  • Leigh_KildayLeigh_Kilday Member Advanced IT Monkey ✭✭✭
    Guess we have to wait until 7.4. My 7.3 returns undefined on the linked problem status.
    Interesting. I am running 7.2 and the provided code works well for me.
  • Adam_DzyackyAdam_Dzyacky Customer Contributor Monkey ✭✭✭✭✭
    Second @Leigh_Kilday - 7.2 works fine for me.
  • john_doylejohn_doyle Cireson Support Adept IT Monkey ✭✭
    Hi Leigh,
    Is it possible that you are using a different relationship to associate the CR and RR workitems? You could try replacing all the references to RelatesToWorkItem with HasRelatedWorkItems in the script and test again.
  • Leigh_KildayLeigh_Kilday Member Advanced IT Monkey ✭✭✭
    Hi John,

    That doesn't work for us either. I'm only creating relationships through the portal.
Sign In or Register to comment.