Message Image  

Maximo Open Forum

 View Only
  • 1.  Adding Observation Field in Maximo Mobile Activities And Tasks Page

    Posted 11-14-2023 13:21

    Business Requirement:

    As per the business requirement free text field for Observation is added in the Activities and Tasks Page


    This is the same observation field in maximo

    As per the requirement users will put the value in the observation field in the mobile and the value will be saved in observation field in Maximo also.

    Issue:After giving the value in the observation field in Maximo Mobile the value is getting disappeared after clicking on the Check icon


    Solution steps:

    observation field in the main activities and tasks related data source woPlanTaskDetailds

     

    observation field in the json data source woPlanTaskDetaildsSelected also which is in the Activities And Tasks page


    Added the below code to create the input field for observation in the Activities And Tasks page

    <box direction="row" children-sizes="100" fill-parent="true" padding-bottom="0.5" fill-child="true" id="k75zx">

                          <smart-input label="Observation" rows="1" input-kind="LONGALN" value="{item.observation}" theme="dark" id="zgg8_"/>

                        </box>

    I have tried with the below options also for the value field

    value=="{ woPlanTaskDetaildsSelected.item.observation}"---Page is not opening

    value=="{ woPlanTaskDetailds.item.observation}"---Same value is coming in every observation field after typing value in one observation field

    Below custom codes are added in the appcustomization

    // new function to inject observation field on event of saving the task data

    onSaveTask(evt){

    evt.record.observation=evt.datasource.currentItem.observation;

    }

    // new function to capture events for the woPlanTaskDetailds datasource and call the onSaveTask function

    onDatasourceInitialized(ds) {

    if (ds.name =="woPlanTaskDetailds")

    {ds.on('before-put-data',this.onSaveTask.bind(this));

    }

    }

    For this I tried with the json data source woPlanTaskDetaildsSelected also like below.But it did not work.

    onDatasourceInitialized(ds) {

    if (ds.name =="woPlanTaskDetaildsSelected")

    {ds.on('before-put-data',this.onSaveTask.bind(this));

    }

    }

    The main issue here is as in this page there is no save button so the function for saving the observation field value is not getting called


    #Mobility

    ------------------------------
    Souvik Dutta
    TCS
    ------------------------------


  • 2.  RE: Adding Observation Field in Maximo Mobile Activities And Tasks Page

    Posted 11-15-2023 01:15

    The tasks data list only displays the values. So you can try adding an on-blur function to your smart input and call datasource.save() or add a custom save button to the top bar and call the save for all task changes.



    ------------------------------
    Maycon Belfort
    BPD Zenith
    ------------------------------



  • 3.  RE: Adding Observation Field in Maximo Mobile Activities And Tasks Page

    Posted 11-15-2023 15:00

    Hi Maycon,

    First of all thank you so much for responding me.

    This below is the xml part

    <box direction="row" children-sizes="100" fill-parent="true" padding-bottom="0.5" fill-child="true" id="k75zx">
                          <smart-input label="Observation" rows="1" value="{item.observation}" on-blur="onObservations" on-blur-arg="{item}" theme="dark" id="a1_v57wb"/>
                        </box>

    and below is the method code i have added in the appcustomization

    onObservations(evt){
      console.log(evt)
    evt.record.observation=evt.datasource.currentItem.observation;
    datasource.save();
    }
    But still after giving the value in the observation field when i am coming back to the activities and tasks page the observation value is getting disappeared.
    Below code which I used before also but it is not getting called
    // new functionto capture events for the
    // woPlanTaskDetaildsSelected datasource and call the onSaveTask function
    onDatasourceInitialized(ds) {
    if (ds.name =="woPlanTaskDetailds")
    {ds.on('before-put-data',this.onSaveTask.bind(this));
    }
    }

    // new functionto inject Observation field on event of // Activities And Task transaction Save
    onSaveTask(evt){
      console.log(evt)
    evt.record.observation=evt.datasource.currentItem.observation;
    }
    Any suggestion on this.


    ------------------------------
    Souvik Dutta
    TCS
    ------------------------------



  • 4.  RE: Adding Observation Field in Maximo Mobile Activities And Tasks Page

    Posted 11-15-2023 15:00

    also this below thing I got from the console log for the onblur method



    ------------------------------
    Souvik Dutta
    TCS
    ------------------------------



  • 5.  RE: Adding Observation Field in Maximo Mobile Activities And Tasks Page

    Posted 11-15-2023 17:40
    Edited by Maycon Belfort 11-15-2023 17:41

    Hi Souvik,

    The error is because you don't have the datasource in your params. Try this instead.

    <box direction="row" children-sizes="100" fill-parent="true" padding-bottom="0.5" fill-child="true" id="k75zx">
        <smart-input label="Observation" rows="1" value="{item.observation}" on-blur="onObservations" on-blur-arg="{item}" theme="dark" id="a1_v57wb"/>
    </box>

    onObservations(evt){
       console.log(evt)
       let ds = this.page.getMainDatasource();
       console.log(ds.currentItem.observation);
       // if observation is empty, you can try:
       // ds.currentItem.observation = evt.observation;
       ds.save();
    }



    ------------------------------
    Maycon Belfort
    BPD Zenith
    ------------------------------



  • 6.  RE: Adding Observation Field in Maximo Mobile Activities And Tasks Page

    Posted 11-15-2023 22:13

    I tried this 

    onObservations(evt)
    {
    console.log(evt) 
    let ds = this.page.getMainDatasource();
    console.log(ds.currentItem.observation);
    ds.currentItem.observation = evt.observation;
    ds.save();
    }

    getting this below error



    ------------------------------
    Souvik Dutta
    TCS
    ------------------------------



  • 7.  RE: Adding Observation Field in Maximo Mobile Activities And Tasks Page

    Posted 11-16-2023 01:10
    Edited by Maycon Belfort 11-16-2023 01:11

    You can try this instead. Just replace your function code for this.

    It seems the main datasource is different from the tasks DS.

    Also, are you using the preview from MAF tool? When using it, you'll get the exact line where it's throwing the error.

    onObservations(item)
    {
        let ds = this.app.findDatasource('woPlanTaskDetailds');
    
        if (ds.getItemChange(item)) {
          ds.save();
        }
    }



    ------------------------------
    Maycon Belfort
    BPD Zenith
    ------------------------------