Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.

DISCLAIMER

All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.

Cireson does not and will not support or maintain these enhancements, extensions, and scripts.

For Team Cireson uploads click here.

Disable CR form once CAB approved

Ben_TeyBen_Tey Premier Partner IT Monkey ✭
Anyone can share your script if you have it.
We got requirement from customer request us to disable the CR form after the CAB approval review activity are approved. This is to prevent of any changes after the CAB approval.

There are few idea in my mind now.
1. Get status of review activity and disable the CR form.
2. Create custom field to indicate when to disable the CR form. A workflow to update the field once CAB approved the CR.

Thing that can help:
1. script to determine review activity status.
2. script to disable CR form

Appreciated if anyone can help on this. Thank you

Comments

  • steve_tuelsteve_tuel Cireson Consultant Adept IT Monkey ✭✭
    edited June 2017
    See attached.  This should get you going in the right direction. This will disable certain fields.
  • Eric_KrasnerEric_Krasner Customer Advanced IT Monkey ✭✭✭
    Very nice, I like it.
  • Ben_TeyBen_Tey Premier Partner IT Monkey ✭
    Then this should disable all field types.
    That awesome. Exactly what i'm looking for. Thank you very much @steve_tuel
  • Alex_MarshAlex_Marsh Premier Partner Adept IT Monkey ✭✭
    This is a great bit of code! Question though, is it possible to target specific change request forms? We have a couple of them (one for change managers and one for standard analysts) and we'd only want to make the analysts form disabled
  • Eric_KrasnerEric_Krasner Customer Advanced IT Monkey ✭✭✭
    Where would this code go?
  • steve_tuelsteve_tuel Cireson Consultant Adept IT Monkey ✭✭
    @eric_krasner you should be able to just drop the code in custom.js and it will run anytime someone opens a Change Request.  This assumes that the Activity step is called "CAB Review".  If it is called something else you would just rename it in the section of code to match.
  • steve_tuelsteve_tuel Cireson Consultant Adept IT Monkey ✭✭

    @alex_marsh you can add an if statement to check if any ChangeRequestForm was loaded for the logged in user.  So when you have a Change Request open you can open Developer Tools (F12) and then go to "session.user" and check the ChangeRequestForm value.  In this example I have an Assigned Form whose Id is "ChangeManager" in ChangeRequest.js.

    Below is the If statement I added to check to see if the user is NOT essentially a Change Manager. 


  • Eric_KrasnerEric_Krasner Customer Advanced IT Monkey ✭✭✭
    So this solution will only work if the CR is being opened in the portal and not the  console, correct?
  • steve_tuelsteve_tuel Cireson Consultant Adept IT Monkey ✭✭
    Yes, this is only within the Portal.
  • Alex_MarshAlex_Marsh Premier Partner Adept IT Monkey ✭✭
    edited June 2017
    @steve_tuel thanks that's a great help! Is it possible to also exclude certain input boxes (i.e. like the action log comment box)?
  • steve_tuelsteve_tuel Cireson Consultant Adept IT Monkey ✭✭
    edited June 2017
    You would either have to use the first option I had at the top where you specify the individual fields to disable, which wouldn't be very ideal.  Or potentially have it target the specific Comment box and button through a few jquery css selector statements to have it re-enable those after the initial disabling has occurred.
  • Ben_TeyBen_Tey Premier Partner IT Monkey ✭
    @steve_tuel can we disabled the completed activity field as well ?
  • Leigh_KildayLeigh_Kilday Member Ninja IT Monkey ✭✭✭✭
    I'd like to go a different way with this. I want to make Implementation Results and Post Implementation Review fields Required when activity conditions are met.

    I have got the script running on the Activity Stage (see below) so I don't have to use the Title, however I can't figure out how to make those fields Required.

    if (vm.Activity[i].Stage.Name == "Review" && vm.Activity[i].Status.Name == "In Progress")
  • Leigh_KildayLeigh_Kilday Member Ninja IT Monkey ✭✭✭✭
    I figured it out.

    $('div[data-role="ImplementationResults"]'.attr('required','true');
    $(textarea[name="PostImplementationReview"]').attr('required','true');
    I did the same with Actual Start and End dates. I haven't figured out how to add " (Required)" to the labels, but that's not a deal breaker.
  • Konstantin_Slavin-BoKonstantin_Slavin-Bo Customer Advanced IT Monkey ✭✭✭
    I haven't figured out how to add " (Required)" to the labels, but that's not a deal breaker.
    $('div[data-role="ImplementationResults"]').prev().append('<span>(Required)</span>');
    $('textarea[name="PostImplementationReview"]').prev().append('<span>(Required)</span>');


  • Leigh_KildayLeigh_Kilday Member Ninja IT Monkey ✭✭✭✭
    I haven't figured out how to add " (Required)" to the labels, but that's not a deal breaker.
    $('div[data-role="ImplementationResults"]').prev().append('<span>(Required)</span>');
    $('textarea[name="PostImplementationReview"]').prev().append('<span>(Required)</span>');


    Legend. Thanks @Konstantin_Slavin-Bo!
Sign In or Register to comment.