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.

Add Support Group Field to Portal MA Activity Form

2»

Comments

  • Adrian_PaechAdrian_Paech Customer Advanced IT Monkey ✭✭✭

    Hey Brad,

    I find the most effective way to send the email when the manual activity status changes to "In progress" is to use a custom workflow which kicks off a powershell script to send the email (rather than a runbook), as this allows for you to be extremely granular with your execution criteria (essentially the same granularity as you would have when setting up an e-mail notification).

    if you have not looked at creating workflows before, I highly recommend giving it a go, as it provides a lot more flexability than runbooks for these types of scenarios.

    Regards,

    Adrian

  • Tim_ShackletonTim_Shackleton Customer IT Monkey ✭
    This custom extension will allow for the addition of a custom Support Group field to the Manual Activity task form in the Portal. Please read the instructions and make the appropriate changes to the code in order for it to function properly. You'll also need to make sure that you import the included Management Packs if you do not currently have Support Group properties on your MA class.

    Hi Seth, great post.  I've implemented it and imported the Cireson DevOps extensions, and checked the enumeration ID matches, but the drop down isn't appearing in my MA forms.  I've copied the contents of the .js to my custom.js.  Is there something extra I should be doing?
  • Mike_DismukesMike_Dismukes Customer IT Monkey ✭
    I have the exact same problem no drop down appearing :neutral: followed all steps possible but version 7.4 of the portal.
  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    Updated link to github repository for easier editing and future updates
  • Brad_HayesBrad_Hayes Member IT Monkey ✭
    I have the exact same problem no drop down appearing :neutral: followed all steps possible but version 7.4 of the portal.
    I had the same problem, it turns out that my "pageForm.viewModel" was returning "AssignmentGroup" and the script was looking for "SupportGroup"
    Specifically all references to "activity.SupportGroup.Id" needed to be updated to "activity.AssignmentGroup.Id"
  • Nick_FlintNick_Flint Customer Advanced IT Monkey ✭✭✭
    This is working as expected for me except for one thing. After selecting a Support Group on a MA and then applying the change, I can't clear the field again.You might do this to remove MA from a Support Group list and display only for the activity implementer. Has anyone else dealt with this?
  • Nick_FlintNick_Flint Customer Advanced IT Monkey ✭✭✭
    This is working as expected for me except for one thing. After selecting a Support Group on a MA and then applying the change, I can't clear the field again.You might do this to remove MA from a Support Group list and display only for the activity implementer. Has anyone else dealt with this?
    This ended up being an easy fix. I just inserted a line at line #153:  
    optionLabel: "Unassign Group...",

  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    Good day! We are working on a custom usage of this and are having an issue with the custom JS script that we could use some assistance with.

    We are trying to add a second custom enumeration list to the Manual Activity form using this method. We've customized the script here to work with our other custom enum by modifying the enumeration GUID, the Manual Activity property name, and changing variable names from "support group / sg / supportgroup / etc." over to new names for our custom enumeration.

    Our customizations work flawlessly when they are the only additional enumeration added to the form. There does not seem to be a problem inherent in the customizations.

    However, when we add both our custom script AND the Support Group custom script to the custom.js file, we get some unexpected behavior - both enumerations are added and behave correctly, except that they both display the values of whichever script ran second.

    We've tested changing the order of the scripts and validated that the displayed list values will always be those of the script that ran second. This tells us that both are functioning, but something in the script logic that performs the binding between the custom drop-down lists and the list values appears to be updating both inserted drop-downs rather than just the one being inserted at the time.

    We've tried identifying which part of the script is causing this behavior, but we've been unable to identify it (our Javascript abilities are not expert-level, so it is possible we're overlooking something obvious, but there doesn't seem to be a clear link to us).

    Would @seth_coussens or anyone else with JS skills be able to assist with customizing the script to address the issue?
  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    Are you able to share your changes?
  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    Seth,

    Yes, definitely. I've attached two archives to this post, one with the customized code specifically for our custom enumeration (Business Unit) and one that combines the existing Support Group code and the Business Unit code in the same JS file. The only change made from the Support Group code as provided was running it through a JS formatter; the content of the code is the same.

    Thanks!
  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    I believe the issue is in the selector. It doesn't have anything that is set unique for each control that is being added, rather the same thing is being set for each control.

    var searchString = 'div[data-activity-id="' + id + '"]';

    and

    var selectString = '#group-selector[data-activity-id="' + id + '"]';

    Basically, you are selecting the same elements each time and linking them to the kendo control, so the second run overwrites the first in a fashion. You need to add something in that uniquely describes each control that you are then selecting.

    Does that make sense?
  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    That makes perfect sense and is what I was assuming was happening. My only question is this - is there a way to uniquely tag the drop-down fields being added by the script, such as by modifying the list-specific function to add a custom attribute that the search string can then filter on?
  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    You could add a unique value to the <select id=""> id property. Just append it to the end, I think that would make it unique and then when it builds the search string below you would just search for the same element with the appended id you used and they should then each be unique. Maybe just a global counter value in the script?
  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    That makes sense. I'll give it a shot and report back with how it goes. Thanks!
  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    I got it working successfully! With your advice, I was able to uniquely tag the lists by changing the lines:

    var list = $('<select id="group-selector" data-activity-id="' + id + '" />');

    and 

    var selectString = '#group-selector[data-activity-id="' + id + '"]';

    to 

    var list = $('<select id="group-selector" data-activity-id="' + id + '-SupportGroup" />');

    and 

    var selectString = '#group-selector[data-activity-id="' + id + '-SupportGroup"]';

    , respectively. (Adding the suffix '-SupportGroup' for the support group list and '-BusinessUnit' for the business unit list.)

    I'm attaching the complete, working code to this post to assist anyone else with the same need later.

    Thank you very much for the help!
  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    edited April 2018
    Hello again @seth_coussens,

    Further testing of the above solution has revealed that it isn't actually working - while the two lists are properly added to the Manual Activity form, populated with the correct list options, and appear to work, nothing is actually saved when clicking the "Save" or "Apply" buttons.

    I've been working on troubleshooting the script and testing various parts (using the Chrome browser's developer tools) but been unable to determine specifically where the script fails. The summary of what I'm seeing is this:

    1. If only one of the two custom Enums are added and the script does not have any of the "-SupportGroup" tags added anywhere (as described in the previous comment, last August), then data is saved for that single custom Enum successfully.
    2. If the "-SupportGroup" tags are added (as described in the previous comment), the list is still populated properly, but does not save.
    3. The problem appears to be related to the event handler for list changes, as when I manually walk through the WalkActivityTree function as if the 'update' type was supplied and run the code "activity.SupportGroup.Id = sgId", the activity is updated successfully when it is saved, though if I don't manually walk through it, the changes aren't saved, implying that that bit of code isn't being run.
    4. I've tried adding the "-SupportGroup" tag to the code where it adds the change event handler, but this has had no impact on the results (the list is still added and mapped properly to its values, but nothing is saved).

    I'm attaching our custom.js file to this comment for you to review in hopes that you may have some ideas. You'll see that only one of the custom lists is added currently, with the code to add the second fully commented out. The one that is added is the "BusinessUnit" list, but the code for the two is otherwise the same (aside from function name changes and tag changes ("-BusinessUnit" and "-SupportGroup"). You'll also see the lines where we've added the list name tag alongside the original lines, which have been commented out.

    Any assistance you could provide would be greatly appreciated. Thanks!
  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    @Nicholas_Velich
    Can you help out @Gabriel_Taylor or get someone from your team to take a look?
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    Hi Gabriel,

    Taking a brief look at your code, I think the issue lies with this portion here:

    // Find the particular form that we are working with, currently this is static
    var searchString = 'div[data-activity-id="' + id + '"]';
    var activityForm = $(searchString).parent().find('.activity-item-form');

    The code as it has been modified would not find anything in the selector here, as it is trying to find elements that do not have your -BusinessUnit or -SupportGroup suffix appended to it. As a first step, you could try adding that BusinessUnit/SupportGroup suffix to the attribute here.


    If that does not do the trick, another thing you can try would be to distinguish "uniqueness of the SupportGroup vs BusinessUnit dropdown" lists at the <select> statement's id-level, rather than at the data-activity-id's attribute level. For example, the original code that defined this was like this (and similar in other parts of the script):

    var list = $('<select id="group-selector" data-activity-id="' + id + '" />');

    and you changed it to this:

    var list = $('<select id="group-selector" data-activity-id="' + id + '-BusinessUnit" />');
    var list = $('<select id="group-selector" data-activity-id="' + id + '-SupportGroup" />');

    try this instead:

    var list = $('<select id="businessunit-selector" data-activity-id="' + id + '" />');
    var list = $('<select id="group-selector" data-activity-id="' + id + '" />');

    Hope that helps!

    Thanks,
    Nick
  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    @Nicholas_Velich - thanks for the reply.

    As to your first suggestion, regarding the search string, we had actually tried that. Making the suggested change there broke everything, while leaving that in the original state allowed things to work. I had the same expectation as you listed, that it would make sense for that to be changed too, but testing proved quite otherwise. :p

    The second suggestion sounds good - I hadn't realized I could change that Id value safely so I hadn't tested that yet. I'll make that change and test it and let you know how it goes. Thanks!
  • Gabriel_TaylorGabriel_Taylor Member IT Monkey ✭
    @Nicholas_Velich - that did the trick! Both lists are now being added, properly populated, and saving correctly. Thank you very much for the assistance!

    I'm attaching the final, working solution here in case anyone else needs it later.
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    No problem-- glad I could help!
  • Keren_MarroquinKeren_Marroquin Customer IT Monkey ✭
    Hi!!
    How could I add two more date fields in the manual activity?
    For example those of Actual Downtime End Date and Actual Downtime Start Date
  • Mikkel_MadsenMikkel_Madsen Customer Advanced IT Monkey ✭✭✭

    @Keren_Marroquin did you manish to add those fields to the manual activity?

Sign In or Register to comment.