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.

Show CR Activity History in the Portal

seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
,------. ,------.  ,---.  ,------.      ,--.   ,--.,------. 
|  .--. '|  .---' /  O  \ |  .-.  \     |   `.'   ||  .---' 
|  '--'.'|  `--, |  .-.  ||  |  \  :    |  |'.'|  ||  `--,  
|  |\  \ |  `---.|  | |  ||  '--'  /    |  |   |  ||  `---. 
`--' '--'`------'`--' `--'`-------'     `--'   `--'`------' 

   
|-------------------------------------------|
| Show Activity History Tasks Install Guide |
|-------------------------------------------|
 
Append the contents of custom.js to the custom.js file found in C:\inetpub\CiresonPortal\CustomSpace
on ALL over your portal servers.

Append the contents of custom.css to the custom.css file found in C:\inetpub\CiresonPortal\CustomSpace
on ALL over your portal servers and change the colour to meet your needs.

Copy the template HTML file to C:\inetpub\CiresonPortal\CustomSpace on ALL of your portal servers.

Refresh your browser to see the task. 

Comments

  • PIERRE-LOUIS_DURRISPIERRE-LOUIS_DURRIS Customer Advanced IT Monkey ✭✭✭
    I have seen that we can extract the user which completed a manual activity in SCSM
    http://www.systemcentercentral.com/get-user-marked-manual-activity-completed-scsm/ 
    Is it possible to add it to the function ?
    Today, we only have the workflow user in the history (as in the console).
  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭
    edited June 2016
  • Michael_BaldryMichael_Baldry Customer Advanced IT Monkey ✭✭✭
    This works awesome in Chrome, but there's a small CSS bug in IE11:

    The "position: fixed" seems to fix the "Close" button to the bottom of the main window, rather than the pop-up window. Is there an easy way to fix this up without breaking Chrome?
  • R_DelawderR_Delawder Member Adept IT Monkey ✭✭
    I had the same issue as above with the close binding to the bottom. had to remove the (style="position: fixed") from the "Var Htmlend =" line of the custom.js to correct the close button as previously referenced. I adjusted and put on the SR form using the same function as defined in for CR. (just copied the custom task and changed ChnageRequest to ServiceRequest)
  • Brad_McKennaBrad_McKenna Customer Advanced IT Monkey ✭✭✭
    Has anyone identified how to retrieve/display activities that are nested? I have  adapted this for SR's as well, and we are limited as we use nesting of activities.
  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Hi Brad,

    This section of the code, loops through the Activity array of the CR / SR and compliles a list of Activites for the Drop down.
    //Create Activity Dropdown values
    for (i=0; i < length; ++i) {
    		activities.push({
    		"Id": pageForm.viewModel.Activity[i].BaseId,
    		"Title": pageForm.viewModel.Activity[i].Id + " - " + pageForm.viewModel.Activity[i].Title
    	});
    }

    You will need to do a iterative loop into the Activity array on each activity to find nested activities and add them to the list. Once in the list, the rest of the code will work as it will just pass the Title and Id to the function that grabs history and displays it in the window.

    Geoff
  • Brad_McKennaBrad_McKenna Customer Advanced IT Monkey ✭✭✭

    Thank you Geoff! When attempting to create on my own, I ran across this post:

    https://community.cireson.com/discussion/355/view-manual-activity-history-in-the-portal

    I'm posting it here in case anyone else is in the same boat as us. On very long workflows, it will make the form take a second or two longer to load. I'm sure someone better at JavaScript than me could fix that up. :smile: 

    Function to get all child activities, not just the top level ones:
    function GetActivitiesRecursively(activities) {
        var allActivities = [];
        var length = activities.length;
            
        for (var i = 0; i < length; i++) {
            var currentActivity = activities[i];
            allActivities.push({            
    "Id": currentActivity.BaseId,
    "Title": currentActivity.Id + " - " + currentActivity.Title
            });
            // If the current activity has any child activities, process those too
            if (currentActivity.Activity && currentActivity.Activity.length > 0) {
                 allActivities = allActivities.concat(GetActivitiesRecursively(currentActivity.Activity));
            }
        }
        return allActivities
    }

    Change to how we create the custom task:
    app.custom.formTasks.add('ChangeRequest', "Activity History", function (formObj, viewModel) {
        var activities = GetActivitiesRecursively(pageForm.viewModel.Activity);
    CRGetActivityHistory(activities);
    });

    This looks similar to what you had suggested, and provides the ability to find all activities. (Although with this suggestion the creation of the custom task was altered to accommodate calling the function)

  • Jonathan_BolesJonathan_Boles Customer Ninja IT Monkey ✭✭✭✭
    Good Afternoon @Seth_Coussens and Cireson Community,

    I'm trying this awesome customization out with Change Requests and when I look at an RA where a reviewer has been added or removed, it lists the item as a number versus the actual object (user display name) as shown in the screenshot below.



    Is there anyway to force this script to show the actual user that's being removed or added to the review activity?
    Any assistance you can provide would be most helpful!

    Thanks,

    Jonathan Boles
  • Geoff_RossGeoff_Ross Cireson Consultant O.G.
    Hi @Jonathan_Bowles,

    This is one of my extensions so I'll jump in.

    Its to do with the 'double hop' relationship between RA and User. An RA has a Reviewer (these get assigned just a number) and a Reviewer has a User. So the History of the RA is correct that a a Reviewer of ID 49 has been added.

    To get the Actual User, we'll need to dive one level deeper in the case that the relationship is ReviewActivityHasReviewer. You would have to call the GetProjectionByCriteria API call to get the Reviewer object with the Type Projection of System.ReviewerProjection and this will include the User Object.

    Is that enough to get you going?

    Geoff
  • Brad_McKennaBrad_McKenna Customer Advanced IT Monkey ✭✭✭

    One thing I did in our environment was add in an Or statement (||) to only show the task when the ticket has activities (using the code referenced in my post above).

    From:

    app.custom.formTasks.add('ChangeRequest', null, function (formObj, viewModel) {
        formObj.boundReady(function () {
            var vm = pageForm.viewModel;
            //If the user is not an analyst, hide the task
            if (!session.user.Analyst) {
                $(".taskmenu li:contains('Activity History')").hide()
            }
        });
        return;
    });

    To:

    app.custom.formTasks.add('ChangeRequest', null, function (formObj, viewModel) {
        formObj.boundReady(function () {
            var vm = pageForm.viewModel;
      var length = vm.Activity.length;
            //If the user is not an analyst, hide the task
            if ((!session.user.Analyst) || (!(vm.Activity.length > 0))) {
                $(".taskmenu li:contains('Activity History')").hide()
            }
        });
        return;
    });

  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    Is there an actual code for both CR and SR activities?

  • Marek_LefekMarek_Lefek Customer Advanced IT Monkey ✭✭✭
    I have some problem, on the activity listy I don't see activities inside Parrarel Activity. Is there possibility to wiew nested activities?
  • Peter_MiklianPeter_Miklian Customer Advanced IT Monkey ✭✭✭
    seth_coussens is there any updated package showing activities history in portal with all mentioned tweaks and questions? Thanks.
  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭

    @Peter_Miklian here is an updated copy that includes all the activities inside PA's and SA's, and also adds a configuration variable to at the top, that can be set to allow for Admin only (0), Admin/Analyst Only (1), or have the menu option on the right for everyone (3)


  • Peter_MuttenthalerPeter_Muttenthaler Partner Advanced IT Monkey ✭✭✭
    edited July 2021

    @Jeff_Lang

    Do you have an updated version of that file?

    Yours doesn't display the activitiy information propper (in the detail window) anymore (Version 10.2.6)

    Thanks in advance!

  • Ann-Christin_WeiergrAnn-Christin_Weiergr Customer IT Monkey ✭

    Is there an update planned? The task is used a lot in our environment.

    With update 11.0.4 it doesn't display the buttons on the front page anymore.

    Thanks in advance!

  • Adam_DzyackyAdam_Dzyacky Product Owner Contributor Monkey ✭✭✭✭✭

    I believe I've righted this. Updated from @Jeff_Lang's above. Tested with v11.x



  • Peter_MuttenthalerPeter_Muttenthaler Partner Advanced IT Monkey ✭✭✭

    @Adam_Dzyacky thank you for the fast updated version.

    Tested it already, looks great! ;)

  • Brian_WinterBrian_Winter Customer Advanced IT Monkey ✭✭✭

    @Adam_Dzyacky , I feel like I was just asking for something like this ;)


    Now to shoe-horn this into History (maybe with some filtering on inconsequential data)


    Thanks also to @Jeff_Lang and @seth_coussens

  • Michael_CostelloMichael_Costello Customer Adept IT Monkey ✭✭

    @Adam_Dzyacky

    Thank you for the update!

Sign In or Register to comment.