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.

Dynamic Forms

IT MonkeyIT Monkey O.G.
edited May 2016 in Cireson Uploads
This script works with both service requests, but can be easily adapted to work with any work item class in the Cireson portal.

Service Request Project Forms

With this example, we use a TemplateId field in the Service Request class, and have it set to _PROJECT_.

When then show a customized tab for the project and hide the general tab. This way you can have a specific layout per work item based on the template id.

Installation

Simply extract and copy the contents of this zip to your customspace\custom.js file.

You will also need to make sure and set the template ID within your service request template that you are using as the target template/request type. You can do this by exporting the templates management pack and adding this property to the xml of the template:
<Property Path="$Context/Property[Type='CustomSystem_WorkItem_ServiceRequest_Library!System.Workitem.ServiceRequest']/TemplateId$">ProjectRequest</Property>

Download the attached .zip file below.

Comments

  • PIERRE-LOUIS_DURRISPIERRE-LOUIS_DURRIS Customer Advanced IT Monkey ✭✭✭
    I am facing one issue using this code in production. When the work item is not closed, every things go right. When the work item is closed, the hiding function above is not check any more and we see all the tab even those which should be hiden regarding the area of the service request.
    Do you have a solution for this issue ? I have the same issue to add a custom task for closed items.
  • Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    Hi Pierre,

    Excellent question! The app.custom.formTasks section does not load for Closed Work Items; however, the custom.js file does still load. Try replacing this section of the code:


    app.custom.formTasks.add('ServiceRequest', null, function(formObj, viewModel){  
            formObj.boundReady( function () {
                    if(viewModel.TemplateId == 'ProjectRequest') {
                            fn_ShowTab("PROJECT", formObj)
                    }else{
                            fn_HideTab("PROJECT", formObj)
                    }
            });
    }); 


    With this:


    $(document).ready(function (){
            var url = window.location.href;
            if(url.indexOf("/ServiceRequest/Edit/") > -1){
                    setTimeout(function() { 
                            if(pageForm.viewModel.TemplateId == 'ProjectRequest') {
                                    fn_ShowTab("PROJECT", pageForm)
                            }else{
                                    fn_HideTab("PROJECT", pageForm)
                            }
                    },1500);
            }
    }); 


    Thanks,
    Nick
  • PIERRE-LOUIS_DURRISPIERRE-LOUIS_DURRIS Customer Advanced IT Monkey ✭✭✭
    Thanks Nick. This work well with the new code. Are we also able to have task for close item ? Print option for example ?
  • Steve_O'ConnorSteve_O'Connor Customer IT Monkey ✭
    Must be missing something, trying to implement this and it get this error:

    The management pack import failed.
    Errors (1):
    Failed to verify ObjectTemplate: Template.7682a488ec864f9eb2eff07b2ac591d2
    : Cannot find ManagementPackElement [Type=ManagementPackClass, ID=System.Workitem.ServiceRequest] in management pack ManagementPack:[Name=System.WorkItem.ServiceRequest.Library, KeyToken=31bf3856ad364e35, Version=7.5.3079.0].

    I've added the portion to the XML of the management pack then go to reimport and get that error :(

  • Chris_JordanChris_Jordan Customer Adept IT Monkey ✭✭
    Is it possible to have required fields on these additional forms and if so, how is it done?

    As it just hides the tabs, this may not be possible??

  • Chris_JordanChris_Jordan Customer Adept IT Monkey ✭✭
    edited July 2016
    Curious, what browser does everyone preference with the dynamic from solution? I seem to get difference results depending on browser, and also different again on new PR releases of the portal.
  • Chris_JordanChris_Jordan Customer Adept IT Monkey ✭✭
    This solution in v6 of the portal makes the "Is Private" checkbox unclickable. Just in case others get caught out this this.
  • Chris_JordanChris_Jordan Customer Adept IT Monkey ✭✭
    This functionality wasn't there on older versions of the portal either, however I never noticed. Where the "Is Private" checkbox in the acitonlog only works on the General tab,
  • Candice_YeudallCandice_Yeudall Customer Advanced IT Monkey ✭✭✭
    I have never really understood the use of the "Is Private" button given that if it is unchecked at anytime the comment will appear to all. As far as I am concerned all comments should be public consumable.
  • Chris_JordanChris_Jordan Customer Adept IT Monkey ✭✭
    File notes or analysts comments that you don't want to bother the end user with is perfect for the "is private" function.
  • Chris_JordanChris_Jordan Customer Adept IT Monkey ✭✭
    When I change the position of;
    name: "FileAttachments",
    type: "fileAttachments"

    It displays very close to the nav side bar.



    Does anyone know how/if it's possible to have is aligned with the other columnFieldLists?
  • Tom_HydeTom_Hyde Customer Advanced IT Monkey ✭✭✭
    Must be missing something, trying to implement this and it get this error:

    The management pack import failed.
    Errors (1):
    Failed to verify ObjectTemplate: Template.7682a488ec864f9eb2eff07b2ac591d2
    : Cannot find ManagementPackElement [Type=ManagementPackClass, ID=System.Workitem.ServiceRequest] in management pack ManagementPack:[Name=System.WorkItem.ServiceRequest.Library, KeyToken=31bf3856ad364e35, Version=7.5.3079.0].

    I've added the portion to the XML of the management pack then go to reimport and get that error :(

    I'm getting the same issue. Could someone clarify where to add the property to the xml file, i expect i'm doing this wrong...
  • Thomas_PeterThomas_Peter Customer IT Monkey ✭
    Hi, the dynamic form works fine for me when using internet explorer, but using chrome the tab is not hidden. Seems to be that Chrome has a problem with the statement $("a[data-toggle='tab'").each . Does anyone else has the same issue? And if yes, any solution?
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    It is missing a square bracket, so it should have a problem with that statement.  This should work:

    $("a[data-toggle='tab']").each( <i>...rest of code...</i>
  • Thomas_PeterThomas_Peter Customer IT Monkey ✭
    Thanks for your reply, the code is now 
    function fn_HideTab(name,form){
     console.log("This is a Standard Request: "  );
     $('a[data-toggle=tab]').each(function(){
      if(this.innerText === name){
       $(this).hide();
      }
     });
    }
    but still not working with chrome. I can see in the F12 log the text "This is a Standard Request", but the tab is still visible. Is it working for you with chrome?


  • Gerhard_GoossensGerhard_Goossens Customer Advanced IT Monkey ✭✭✭
    Tom_Hyde said:
    Must be missing something, trying to implement this and it get this error:

    The management pack import failed.
    Errors (1):
    Failed to verify ObjectTemplate: Template.7682a488ec864f9eb2eff07b2ac591d2
    : Cannot find ManagementPackElement [Type=ManagementPackClass, ID=System.Workitem.ServiceRequest] in management pack ManagementPack:[Name=System.WorkItem.ServiceRequest.Library, KeyToken=31bf3856ad364e35, Version=7.5.3079.0].

    I've added the portion to the XML of the management pack then go to reimport and get that error :(

    I'm getting the same issue. Could someone clarify where to add the property to the xml file, i expect i'm doing this wrong...
    I am also getting this error, I think it has something to to with the GUID of that property...

    The management pack import failed. 
    Errors (1):
    Failed to verify ObjectTemplate: Template.c75e2c570a2746808f3dcd16ce97d5fc
    : Cannot find ManagementPackElement [Type=ManagementPackClass, ID=System.Workitem.ServiceRequest] in management pack ManagementPack:[Name=System.WorkItem.ServiceRequest.Library, KeyToken=31bf3856ad364e35, Version=7.5.7487.0].



  • Gerhard_GoossensGerhard_Goossens Customer Advanced IT Monkey ✭✭✭
    IT Monkey said:
    This script works with both service requests, but can be easily adapted to work with any work item class in the Cireson portal.

    Service Request Project Forms

    With this example, we use a TemplateId field in the Service Request class, and have it set to _PROJECT_.

    When then show a customized tab for the project and hide the general tab. This way you can have a specific layout per work item based on the template id.

    Installation

    Simply extract and copy the contents of this zip to your customspace\custom.js file.

    You will also need to make sure and set the template ID within your service request template that you are using as the target template/request type. You can do this by exporting the templates management pack and adding this property to the xml of the template:
    <Property Path="$Context/Property[Type='CustomSystem_WorkItem_ServiceRequest_Library!System.Workitem.ServiceRequest']/TemplateId$">ProjectRequest</Property>

    Download the attached .zip file below.


    How can this be modified to work with Incidents? 
    From what I can tell, I have to extend the Incident Class with a TemplateId$ property?
    Is there perhaps an easier way to to this or maybe another property I can target?

    We are in the beginning stages of testing/deployment and currently we only use IR's 

    Any guidance will be appreciated.

    Regards
    Gerhard
  • John_BeasleyJohn_Beasley Customer IT Monkey ✭

    I'm Trying this out and i keep getting a management pack error.


    The management pack import failed. 

    Errors (1):

    Failed to verify ObjectTemplate: Template.7a781144268c47dc9dd9cfe01a342cf7

    : Cannot find ManagementPackElement [Type=ManagementPackClass, ID=System.Workitem.ServiceRequest] in management pack ManagementPack:[Name=System.WorkItem.ServiceRequest.Library, KeyToken=31bf3856ad364e35, Version=7.5.3079.0].

    What could I be doing wrong?


    Thanks John

Sign In or Register to comment.