Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

Β View Only
  • 1.  Get the full workorder resource Anywhere 764

    Posted Tue May 04, 2021 01:16 PM
    Hi,

    I am doing a customization on the WorkExecution App and I would need to get information from the workorder associated to the WorkOrderTimer.

    on the woTimer, there is a WONUM. I can get this easily but how can I find this workorder on the workorder resource anytime in the woList view ? 

    I tried getting the workorder resource from many differents ways but it is always fill with the workorder from the actual query. If my timer is started on a workorder not shown in a specified query, I can't get it.

    How can I do this ? 

    Thank you

    ------------------------------
    Mathieu Guilmette
    ------------------------------



    #MaximoAnywhere
    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: Get the full workorder resource Anywhere 764

    Posted Wed May 05, 2021 02:05 AM
    Edited by System Admin Tue August 22, 2023 04:41 PM
    Not knowing the specific of the action you are trying to invoke or where you might be within the app when you try to make the call to the active wotimer resource makes this a bit tricky.  However the workOrderTimer resource is a singleton. Meaning you can only have one record at a time.  With that being the case you should structure your custom script to call the application resource and grab the wound value directly form the resource.  Also use logic in your method to ensure the singleton returns a value and throw a message if the wotimer is not active.

    Hope this helps.


    ------------------------------
    Bradley K. Downing , MBA
    IBM Certified Adv. Deployment Prof. Maximo v7.6.1
    IBM
    Bakersfield CA
    ------------------------------



  • 3.  RE: Get the full workorder resource Anywhere 764

    Posted Wed May 05, 2021 09:11 AM
    Hi Bradley, 

    Everytime that I look at the application resource, if the workorder associate to the timer does not figure on the actual listview query, this workorder is not fetch in the application.getResource('workorder')

    I use the find() function within the resource.

    Thank you

    ------------------------------
    Mathieu Guilmette
    ------------------------------



  • 4.  RE: Get the full workorder resource Anywhere 764

    Posted Wed May 05, 2021 09:38 AM
    So you are going to workOrderTimer and getting the wound, then using that value and trying to fetch the workOrder from the workorder resource?  Are you offline or online when you do this? Have you downloaded the worklist? How many work orders are in the query? your resource page size for workOrder is 20 out of the box. Have you changed that? 

    What are you actually trying to do and how do you anticipate doing it?  Have you created an action perhaps and you want to say for example: Tap on the menu list, and then tap on an action that says "Get Work Order for Current Timer" or some such notion?  Has the user switched wordlists? (i.e. used a different query to populate the worklist such that the work order is no longer in the list?"

    ------------------------------
    Bradley K. Downing , MBA
    IBM Certified Adv. Deployment Prof. Maximo v7.6.1
    IBM
    Bakersfield CA
    ------------------------------



  • 5.  RE: Get the full workorder resource Anywhere 764

    Posted Wed May 05, 2021 10:00 AM
    I am currently doing a customization to do a resetTimer() if the workorder that the timer is active meets a specific condition. To know this, I need to get the workorder using the wonum field in the wotimer.

    I am in the WOListHandler.js. in the render function.

    I am currently doing something like this :

    var workOrderSet = eventContext.application.getResource('workOrder');
    var wotimerWO = workOrderSet.find("wonum == $1", woTimer.get("wonum"));


    I looked at the debug tool in chrome and the workOrderSet is filled with only the workorder that the current query fetch. So if this specific workorder is not in the list, the resource doesn't fetch it and woTimerWO is empty so I can't access the information that I need.

    ------------------------------
    Mathieu Guilmette
    ------------------------------



  • 6.  RE: Get the full workorder resource Anywhere 764

    Posted Wed May 05, 2021 10:34 AM
    OK.  So you should just go to the wotimer and get that resource.  This is a gain a stain singleton resource.  If there is a workorder with an active timer then it will be there.  You should look at the application.handler.StopTimerHandler.  There is a method in there called pauseWorkHandler.  That should be the approach you take to reset the timer. 

    Also you say that you are  in the "render function".  That function is pretty limited and is really there to clean up the Spatial sketching.  Is this action related to that method?  Or ar you just using that because it says render?  Consider the timing of the action you are performing and from whence you are calling the action.  Is this a "random" event that a user invokes form an action on the menu list?  What is the business use case justification for the custom action?  (i.e. the agile method "story" behind the coding you are doing?). For Example: Zeke needs to be able to reset an active workorder timer, due to an emergency call-out but he does not know the active workorder. (happens more often than you might think πŸ˜‰ ). Is this similar to what you are trying to do?

    ------------------------------
    Bradley K. Downing , MBA
    IBM Certified Adv. Deployment Prof. Maximo v7.6.1
    IBM
    Bakersfield CA
    ------------------------------



  • 7.  RE: Get the full workorder resource Anywhere 764

    Posted Wed May 05, 2021 10:53 AM
    Our problem is that sometimes, for a reason that we haven't found yet, when a user pause or complete his timer, the actuallabor is transfered to maximo correctly but the timer does not reset. If the user does not use Anywhere that much or the timer, if the next time that he wants to start the timer and if the previous wokorder is closed, then the timer get stuck and there is no way to stop it. The user is now stuck with the message "You need to stop the timer on workorder XXXXXX before starting a new one" but the workorder XXXXXX can't be access or modify.

    So what I want to do is at the render of the WoList, I look at the Workordertimer resource, if the wonum is not null, I want to access this workorder and look at the actuallaborlist. If there is a actuallabor with the same laborcode and the same starttime, then resetTimer because we are now facing the issue.

    I don't know if there's a better way to approach this issue but we have an IBM case opened for a long time and we're not able to find nor reproduce the issue and the client wants a solution so I must found something

    ------------------------------
    Mathieu Guilmette
    ------------------------------



  • 8.  RE: Get the full workorder resource Anywhere 764

    Posted Thu May 06, 2021 01:59 AM
    Hi Mathieu,

    Read the whole thread to understand your issue.
    First of all I have seen this issue in 763 with timer and has been a big problem in the past.
    I like your thought on the solution but not sure if might work on all the condition.

    Here is my solution after reading the thread:
    1. You need to write your code in the wolisthandler's render method( may there is a better place to write this but this is what i can think of).
    2. Work Order resource has attribute called actuallaborlist. Check if you are able to see data in this attribute in the render method else better to create a action menu to clear the timer.
    3. Once you have the actuallaborlist then it should be easy i believe.
    4. Fetch the worktimer resouse and check if it is started then if yes then check the actuallaborlist resource for your data and then call the reset timer.

    woListHandler class code will really helpful to build this logic.
    Hope this helps.

    ------------------------------
    Biplab Choudhury
    Maximo Consultant
    Tata Consultancy Services
    Melbourne
    ------------------------------



  • 9.  RE: Get the full workorder resource Anywhere 764

    Posted Thu May 06, 2021 09:33 AM
    Hi, 

    This is actually what i'm doing. Here is my issue :

    For example, We have two workorder queries A (workorder priority 1) and B (workorder priority 2).

    The user starts and pause a timer in the list A, and then go on the list B, the render is called. the eventContext.application.getResource('Workorder') contains only the workorder in the list B so if the timer is stuck on the workorder in A , I have no clue on how to get the workorder to be able to access actuallaborlist.

    I have no Idea on when and how this issue can happen. If it's right when the user clicks on "Pause work" or "Complete Work" that the timer doesn't reset, it will work because the render is also called at this time because we are going from the Timer view to the woList view. If the issue happens somewhere else, this customization may not fix the issue.

    Thank you

    ------------------------------
    Mathieu Guilmette
    ------------------------------