Menu

StopWatch Breaks on Custom States - Followed the itop Tutorials

2024-07-25
2024-07-30
  • Karthik Kanthaswamy

    Hi Team,

    I have introduced few custom statuses by creating an extension following the tutorials in iTop site, it worked like a charm except for the Stopwatch... :(

    The statuses are as follows

    In Progress -->Inherited from Assigned (be treated same like Assigned TTO and TTR should count in this state)
    Pending_3rdParty --> Inherited from Pending (TTO, TTR should be paused)
    Pending_client --> Inherited from Pending (TTO, TTR should be paused)
    Pending_upgrade --> Inherited from Pending (TTO, TTR should be paused)

    And the transitions are as follows

    1. New-->Assigned-->In Progress --><pending statuses="">-->Resolved</pending>

    2. These pending statuses can transition from each other, From Pending this can go to In Progress/Reassigned and then to Resolved

    Here I viewed the iTop objects schema of UserRequest from inside the iTop and wrote the below code to repurpose few fields the suite to my requirements.
    Here is what happens from when I change my status from ASSIGNED to IN PROGRESS; The TTR Deadline data just vanishes from the UI and the TTR_Stopped trips (In DB when checked) somehow.
    **
    Here is a look into the code which I have written.

    <field id="cumulatedpending" xsi:type="AttributeStopWatch" _delta="redefine">
                        <states>
                            <state id="pending_3rdparty"></state>
                            <state id="pending_client"></state>
                            <state id="pending_upgrade"></state>
                            <working_time/>                        
                            <always_load_in_tables>true</always_load_in_tables>
                        </states>
                        <thresholds/>
                    </field>
                    <field id="pending_sec_tracker" xsi:type="AttributeSubItem" _delta="define">
                        <target_attcode>cumulatedpending</target_attcode>
                        <!-- Possible item_code: timespent, started, laststart, stopped  -->
                        <item_code>timespent</item_code>
                    </field>
                    <field id="ttr" xsi:type="AttributeStopWatch" _delta="redefine">
                        <states>
                            <state id="new"></state>
                            <state id="assigned"></state>                        
                            <state id="approved"></state>
                            <state id="in_progress"></state>
                            <state id="escalated_tto"></state>
                            <state id="escalated_ttr"></state>
                            <working_time/>                        
                            <always_load_in_tables>true</always_load_in_tables>
                        </states>
                        <thresholds/>
                    </field>
                    <field id="ttr_escalation_deadline" xsi:type="AttributeSubItem" _delta="must_exist">
                        <target_attcode>ttr</target_attcode>
                        <!-- Possible item_code: timespent, started, laststart, stopped  -->
                        <item_code>100_deadline</item_code>
                    </field>
                </fields>
                <lifecycle>
                    <stimuli>
                        <stimulus id="ev_in_progress" xsi:type="StimulusUserAction" _delta="define"/>
                        <stimulus id="ev_awaiting_support" xsi:type="StimulusUserAction" _delta="define"/>
                        <stimulus id="ev_pending_3rdparty" xsi:type="StimulusUserAction" _delta="define"/>
                        <stimulus id="ev_pending_client" xsi:type="StimulusUserAction" _delta="define"/>
                        <stimulus id="ev_pending_upgrade" xsi:type="StimulusUserAction" _delta="define"/>
                    </stimuli>
                    <states>
                        <state id="assigned" _delta="must_exist">
                            <flags></flags>
                            <transitions _delta="redefine">
                                <transition id="ev_in_progress">
                                    <stimulus>ev_in_progress</stimulus>
                                    <target>in_progress</target>
                                    <actions/>
                                </transition>
                                <transition id="ev_reassign">
                                    <stimulus>ev_reassign</stimulus>
                                    <target>assigned</target>
                                    <actions/>
                                </transition>
                            </transitions>
                        </state>
                        <state id="in_progress" _delta="define">
                            <flags>
               <!-- The rationale for this line is because since this field already exist; I just need to make it visible in the In Progress status with out the need for again writing a <presentation>  -->            
                            <attribute id="ttr_escalation_deadline">
                            <read_only/>
                            </attribute></flags>
                            <transitions>
                                <transition id="ev_pending_3rdparty">
                                    <stimulus>ev_pending_3rdparty</stimulus>
                                    <target>pending_3rdparty</target>
                                    <actions/>
                                </transition>
                                <transition id="ev_pending_client">
                                    <stimulus>ev_pending_client</stimulus>
                                    <target>pending_client</target>
                                    <actions/>
                                </transition>
                                <transition id="ev_pending_upgrade">
                                    <stimulus>ev_pending_upgrade</stimulus>
                                    <target>pending_upgrade</target>
                                    <actions/>
                                </transition>
                                <transition id="ev_wait_for_approval">
                                    <stimulus>ev_wait_for_approval</stimulus>
                                    <target>waiting_for_approval</target>
                                    <actions/>
                                </transition>
                                <transition id="ev_reassign">
                                    <stimulus>ev_reassign</stimulus>
                                    <target>assigned</target>
                                    <actions/>
                                </transition>
                                <transition id="ev_resolve">
                                    <stimulus>ev_resolve</stimulus>
                                    <target>resolved</target>
                                    <actions/>
                                </transition>
                            </transitions>
                            <inherit_flags_from>assigned</inherit_flags_from>
                        </state>
    

    I have put a lot of efforts. Still no luck. Please guide me...!

     
    😄
    1

    Last edit: Karthik Kanthaswamy 2024-07-25
  • Vincent @ Combodo

    May I suggest to move the delta="redefine" from the "field" xml tag to the "states" xml tag

    <field id="ttr" xsi:type="AttributeStopWatch">
                        <states _delta="redefine">
    

    Because this is the only thing that you want to change...
    It may help if out of the box this ttr stopwatch has other tags defined, for eg. if you use "Enhanced SLA with coverage window" then your XML would breaks it.

     
  • Karthik Kanthaswamy

    Hi Vincent,

    Amazing, It worked like a charm...!!

    But another issue which I noticed is 2 fields are missing when I resolve the ticket. Resolution Date and Resolution Delay.

    I even tried with this

    <state id="resolved">
                            <flags>
                                <attribute id="resolution_date">
                                    <read_only/>
                                </attribute>
                                <attribute id="time_spent">
                                    <read_only/>
                                </attribute>
                            </flags>
                        </state>
    

    This is the final pending thing.

     

    Last edit: Karthik Kanthaswamy 2024-07-26
  • Karthik Kanthaswamy

    Hi Combodo,

    Team , Kindly assist me help me correct the mistakes.

     
  • Karthik Kanthaswamy

    Hi Team,

    May I please get some help ?

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2024-07-29

    Please have some patience :)

    Combodo is a French company; so they work from Mon-Fri. On top of that, this is the Summer holiday period. And the (free) support given on the board is purely out of good will for them. Priority goes to supporting the paid editions :)

     
    • Karthik Kanthaswamy

      Sorry about that...! I was unaware of this ..! Will surely keep in mind.. Thanks

       
  • Karthik Kanthaswamy

    Hi Team,

    I was able to fix this by using the code snippet

    <transition id="ev_resolve">
                                    <target>resolved</target>
                                    <actions>
                                        <action>
                                            <verb>SetCurrentDate</verb>
                                             <params>
                                                <param xsi:type="attcode">resolution_date</param>
                                            </params>
                                        </action>
                                    </actions>
                                </transition>
                            </transitions>
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.