Maximo Open Forum

 View Only
  • 1.  Defaulting a value on the UI for Worktype and targstartdate maximo mobile

    Posted 04-24-2024 09:08

    Hi Team,

    Is there a way we can default a value on the UI for worktype and targstartdate on a new and followup workorder for maximo mobile through MAF?

    Added below code for new WO,but doesn't seem to work for worktype and targstartdate ,works for persongroup though.

    onAddNewRecord({datasource, item}) {      
         
         if (datasource && datasource.name === "dsCreateWo")  
     
              item.worktype = "CM"
              item.persongroup="MAINT"
              item.targstartdate= new Date()
              console.log('Exiting AppCustomizations.onAddNewRecord');
     
        }
    Thanks,
    Chinmaya Kore.

    #Customizations
    #EverythingMaximo

    ------------------------------
    CHINMAYA KORE
    WIPRO
    ------------------------------


  • 2.  RE: Defaulting a value on the UI for Worktype and targstartdate maximo mobile

    Posted 04-24-2024 09:37

    worktype is a bit more complicated... the prepareDefaultData method in the WorkOrderCreateController has some logic to set the default based on database defaults or clear the value for the attributes we setup out of the box. This causes your default to get cleared since that logic fires after.

    For targstartdate, that is an attribute we do not have out of the box so we would not try to clear the default. I would personally use this:

    this.app.dataFormatter.currentDate();

    This ensures the data is provided in the format we need based on various settings. 


    ------------------------------
    Steven Shull
    IBM
    ------------------------------



  • 3.  RE: Defaulting a value on the UI for Worktype and targstartdate maximo mobile

    Posted 04-25-2024 10:42

    Hi Steven,

    Thanks for your reply.

    I tried defaulting the worktype on the datasource level for new WO, dscreateWO and it worked for new workorders

    <attribute default-value="CM" id="y6nm_" name="worktype"/>
    Same thing when we try for followup workorders using 
    dsWoedit, It doesnt work.
    Any suggestions for defaulting worktype value on the UI for followup page?
    Thanks,
    Chinmaya Kore.


    ------------------------------
    CHINMAYA KORE
    WIPRO
    ------------------------------



  • 4.  RE: Defaulting a value on the UI for Worktype and targstartdate maximo mobile

    Posted 8 days ago
    Edited by Ivan Lagunov 8 days ago

    Hi Steven,

    I've got a similar task to modify the default work type when creating a new work order. You mentioned it's a bit more complicated but it's still unclear how to achieve that. Moreover, in MAS 9 it became even more complicated. I see that in MAS 9 there is more logic added in WorkOrderCreateController.js, i.e. this.setPriority() call that fires even after prepareDefaultData call and sets the worktype field to EM:

    setPriority() {
    const dsCreateWo = this.page.datasources["dsCreateWo"];
    dsCreateWo.item["wopriority"] = 1;
    dsCreateWo.item["worktype"] = "EM";
    }

    In addition, I see that "EM" worktype is also hardcoded in another function - WorkOrderCreateController.validateFields().

    Having the "EM" worktype value hardcoded there seems to make it impossible to customize it in the IBM-supported way, i.e. via AppCustomizations.js. So far I can only imagine one solution - creating a customized copy of the controller with the modified default worktype value.

    Could you please share your thoughts on how to address this? I think it makes sense to create the support case to make it more flexible. But I'm looking for a solution for the current version already.

    Tagging you here to bring it to your attention @Steven Shull. Thanks for your help in advance!



    ------------------------------
    Best regards,
    Ivan Lagunov
    ZNAPZ
    ------------------------------



  • 5.  RE: Defaulting a value on the UI for Worktype and targstartdate maximo mobile

    Posted 7 days ago

    Since my previous response, we've changed the behavior of the default in newer patches to check if there is a value before setting it in the prepareDefaultData method. This should prevent our logic from overwriting your logic.

    The hardcoded worktype in setPriority that's set when we create a Quick Reporting WO I wasn't aware of and there is no good way around it again. This to me is a bug (though for clarity, I don't represent the product team and can't declare something to be a bug) because there's no guarantee EM is even a valid work type in a customer system. If we are going to default it, it should be a system property that we pull & utilize to provide customers the ability to modify it. And honestly, the priority being set to 1 is a problem too because customers can have their own value list tied to wopriority and 1 is not always the highest priority.

    The assumption that all quick reporting WO is automatically an emergency that's the highest priority is honestly a bad assumption. Most customers that do quick reporting in Maximo just do it to make the technician's lives easier and have them use it for all WOs rather than restricting it to only emergency work. I'd honestly prefer if we removed all the special handling for quick reporting. 



    ------------------------------
    Steven Shull
    IBM
    ------------------------------