Maximo

 View Only
  • 1.  Create related records maximo mobile

    Posted Wed November 15, 2023 10:00 PM

    Is there an an easy way to create Related workorders in maximo mobile (For EAM).When the user clicks on "Create Relate Work"the page should open and the the RELATEDRECORD.RELATETYPE should be set to RELATED.I checked the controller RelatedWoController and understood that the logic is in WorkOrderEditController. Can you please guide on how I should go ahead with this requirement.Below are the UI changes I did.

    Image



    ------------------------------
    Chinmaya Kore
    ------------------------------


  • 2.  RE: Create related records maximo mobile

    IBM Champion
    Posted Thu November 16, 2023 01:37 AM

    I haven't tested it but you can try this. I'm assuming the datasource is the related record one.

    onBeforeAddData({datasource, item, options}) {
        if (datasource.name === 'THE DATASOURCE ID') {
            item.relatetype = 'RELATED'
        }
    }

    You can learn more about these functions and how to intercept the datasource events here: https://www.bpdzenith.com/the-bpd-blog/maximo-mobile-event-emitter



    ------------------------------
    Maycon Belfort
    Consultant
    BPD Zenith
    Melbourne
    Australia
    ------------------------------



  • 3.  RE: Create related records maximo mobile

    Posted Mon November 20, 2023 03:05 PM

    Thanks Maycon for your reply. I tried using the dsWoedit datasource to set the value,But I wasnt able to set it. Am I using the correct data source?



    ------------------------------
    Chinmaya Kore
    ------------------------------



  • 4.  RE: Create related records maximo mobile

    IBM Champion
    Posted Mon November 20, 2023 05:55 PM

    Hi Chinmaya,

    I thought you were trying some custom code. If you're trying to modify the OOTB behaviour, you probably will need to do more.

    In the TECHMOBILE/src/WorkOrderEditController.js source code, there is a createFollowupWo function, which you can read and try to understand how the FUP work order is being created. That being said, you can try to catch the event on-before-save on your AppCustomizations.js using the functions onBeforeSaveData and onBeforeUpdateData (not sure if this one exists. If not, you can add an event listener on your pageResumed).

    The onBeforeSaveData will be used to catch the save event on newWods, and you will need to remove the origrecordid, origrecordclass, and origwoid fields. Those are the fields that create the FOLLOWUP type in Maximo.

    The onBeforeUpdateData will be used to change the relation type on the woDetailRelatedWorkOrder datasource.

    I wrote a blog explaining how those events work in Mobile. You can read it to understand better what you need to do. https://www.bpdzenith.com/the-bpd-blog/maximo-mobile-event-emitter

    Cheers.



    ------------------------------
    Maycon Belfort
    Consultant
    BPD Zenith
    Melbourne
    Australia
    ------------------------------



  • 5.  RE: Create related records maximo mobile

    Posted Sun December 10, 2023 10:25 AM
    Edited by Chinmaya Kore Sun December 10, 2023 10:26 AM

    Hey@Steven Shull,

    Can you please guide here.

    Thanks,

    Chinmaya Kore



    ------------------------------
    Chinmaya Kore
    ------------------------------



  • 6.  RE: Create related records maximo mobile

    Posted Mon December 11, 2023 09:17 AM

    This would take me some time to figure out how to build it properly in mobile and I don't have the time right now to do this. When you create a follow up WO, it's calling the createWorkorder function on the original WO mbo. This automatically creates the follow up WO and the related record entries. 

    What I think you need to do is use the create work order page (or a new page, definitely would not recommend the edit WO that we use for follow-up WOs) and as part of that datasource, send the RELATEDRECORD entry that maps it back to the original WO. Since relatedrecord object is part of the MXAPIWODETAIL object structure, you should be able to do that. I would test this in a REST API utility like Postman, figure out what you need to send exactly during the record creation, and then try to implement that in Maximo Mobile. 



    ------------------------------
    Steven Shull
    ------------------------------