Message Image  

Clarity Service Management

Expand all | Collapse all

I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

Jump to Best Answer
  • 1.  I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 08:22 AM

    is there an incident transition condition macro to block an incident from closing if the associated CHANGE is NOT closed?

      

    I tried creating the following macro but getting macro error while trying to close the incident

     

    TABLE Spell_Macro
     del description fragment id last_mod_by last_mod_dt lock_object msg_html
     msg_tmpl_info ob_type persid sym tenant type usr_integer1 usr_integer2 usr_integer3
     usr_string2 usr_string3 usr_string4
     { "0" ,"return FALSE if Status = Closed",
     "if (chg.status == \"CL\") {\\0012   set_return_data(FALSE);\\0012} else {\\0012   set_return_data(TRUE);\\0012}",
     "400239" ,"" ,"05/29/2018 11:10:28" ,"0" ,"" ,"" ,"cr" ,"macro:400239",
     "Chg. Status <> Closed" ,"" ,"COND" ,"" ,"" ,"" ,"" ,"" ,"" }



  • 2.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 11:51 AM

    Richard, I don't think the macro will work as sdm can't recognize chg.status from in. What you could do is to use preSaveTrigger2() js function on the detail_in.htmpl page so if the associated change order does not close yet the incident can't be closed. Thanks _Chi



  • 3.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 12:12 PM

    If you are using the "resolution change order" (not sure of the translation i'm using french sdm) field, you need to use change.status. Not chg.status



  • 4.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 02:17 PM

    Pier-Olivier, at the schema level, all language packages will be the same--being French version or English version does not make a difference. Thanks _Chi



  • 5.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 02:37 PM

    Fully aware of that

     

    I was talking about my translation of the field label ! "resolution change order"



  • 6.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 03:01 PM

    Forgive me not knowing the SDM French UI



  • 7.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 05:38 PM

    You may still have issues with this code (assuming it works) for the fact that any incident that does not have a CO associated may throw an error preventing a closure. You may have to add another condition to check that the value of the 'change' field is either null or change.status == CL (if you like to go the custom code route)

     

    See below - for an option to go the configuration route.



  • 8.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 01:15 PM

    Thank you for the response, I will try out your suggestions



  • 9.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed
    Best Answer

    Posted 06-01-2018 03:59 PM

    You do not need any custom code to do this. You can just use configuration.
    (1) Create an "Activity Association" for object "Request/Incident/Problem" called "Change Active" with code say "cr_chg_act" and Object Attribute "change.active".

    (2) Now create a new macro (site defined condition) with the following information:

       (a) Symbol: Change is Inactive, Object: Request/Incident/Problem, Macro Type: Site Defined Condition [SAVE]

       (b) Now, add atomic condition - Sequence: 10, Attribute: Change Active, Data Value: Equals NO

    (3) Now for "Incident Transitions", choose the transitions for which you want to restrict. As an example, I am choosing say from "In progress" to "Closed". Edit each such transition and add a condition "Change is Inactive". Also add the "Condition Error Message" as say "WARNING: Closure not allowed: The attached Change Order is still active."

    You are done.

    Now test for any Incident which has a Change Order that is active and try to change the status (in our case from 'In progress' to 'Closed'). It will not allow the transition and will throw the error message you configured above.

     

    This may be extended for Problem and Request too in a similar manner.

     

    All the best.

    Indrajit Banerjee.



  • 10.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-01-2018 05:30 PM

    Just to add for Step (2) above, you will require a second atomic condition as follows:

       (c) Now add another atomic condition - Sequence 20, Attribute: Change, Condition: Empty/Null

       (d) Now edit the macro (which gives you the option of 'Edit in List' for the atomic condition. Change the connector from "AND" operation to "OR" operation for Sequence 10 (atomic condition).

    This makes sure that the incidents that are not associated to a change order are not impacted by this transition restriction.

     

    Thanks,

    Indrajit Banerjee.



  • 11.  Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 06-04-2018 11:30 AM

    Exactly what I was looking for. Thank you Indrajit



  • 12.  RE: Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 08-23-2019 10:17 AM
    Hi Indrajit ,

    Using This step i configured it working, But  when change order not attached then also same notification popup and ticket cannot be closed please .


    Regard,
    Malay Saha


  • 13.  RE: Re: I would like the ability to stop an Incident from Closing if an Associated Change has not been closed

    Posted 08-23-2019 10:30 AM


    ------------------------------
    HCL Technologies
    ------------------------------