Home Cireson Uploads
image


IT Monkey will place code here as examples of what Cireson's consulting team has to offer as well as examples for public consumption to benefit the Microsoft System Center community as a whole.

DISCLAIMER

All files and projects located here come as is and without any warranty or support. We will attempt to improve the projects as time goes on based on customer and community demand. Comments and improvements are welcome as well as customization requests. Your use of these Cireson Uploads is subject to our Terms of Use.


Cireson's support team has no information on these projects outside of what you have available and will not provide support for these enhancements, extensions, and scripts.

Dont forget to checkout solutions uploaded by our customers, partners and community members here.

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

IT MonkeyIT Monkey O.G.
edited February 2017 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 Ninja IT Monkey ✭✭✭✭
    edited February 2017
    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 Super IT Monkey ✭✭✭✭✭
    Guess we have to wait until 7.4. My 7.3 returns undefined on the linked problem status.
  • Leigh_KildayLeigh_Kilday Member Ninja 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 Product Owner Contributor Monkey ✭✭✭✭✭
    Second @Leigh_Kilday - 7.2 works fine for me.
  • john_doylejohn_doyle Cireson Support Ninja 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 Ninja IT Monkey ✭✭✭✭
    Hi John,

    That doesn't work for us either. I'm only creating relationships through the portal.
  • Erin_MurphyErin_Murphy Customer IT Monkey ✭

    Hi, this looks great! Is this added to the incident.js file?

  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭
    @Erin_Murphy Add to the custom.js
Sign In or Register to comment.