Maximo

Maximo

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

 View Only
  • 1.  Maximo Mobile Count Books

    Posted Fri February 21, 2025 04:09 PM

    I need help with some development against Maximo Mobile Count Books (ICMOBILE). I have added memo_ud to the counted tab, so when the users are ready to save their progress they can add a note to the part and save that back into the Maximo UI. RoleBased App works. But the mobile piece is partially working. If the user does a count and then saves it and then adds a memo it works. But if a user adds a count and a memo it just spins and the memo doesn't get updated but the count is recorded. If a user adds a count but a memo to a different part and saves, it spins but everything updates. I'm lost. 

    This is what I've added to the CountBookDetailPageController.js.

    async updateMemoField(item, event) {
       const newValue = event.target.value;
       if (typeof newValue === 'string') {
           item.memo_ud = newValue; // Update memo field
         this.page.state.enablesave = true;
           try {
               const dataSource = this.page.findDatasource('countBookDetailDSCounted_JSON');
               const modifiedItems = dataSource.items.filter(item => item.memo_ud === newValue); // Get modified items
               // If there are modified items, save the memo
               if (modifiedItems.length > 0) {
                   const response = await dataSource.save({ waitForUpload: true });
                   console.log("Memo saved successfully");
               }
           } catch (error) {
               console.error("Error saving memo:", error);
           }
       }
    }

    Any help would be appreciated!



    ------------------------------
    Stacy Yeater
    ------------------------------


  • 2.  RE: Maximo Mobile Count Books

    Posted Thu February 27, 2025 08:19 AM

    I was able to figure this out by simplifying the logic.

    async updateMemoField(item, event) {
       const newValue = event.target.value;
       if (typeof newValue === 'string') {
           item.memo_ud = newValue; // Update memo field on the UI item
           // Also update the main datasource record so this change is saved with physcnt/physcntdate
           const mainDS = this.page.findDatasource(this.getDataSouceName_countBookDetailDS4Saving());
           const record = mainDS.items.find(rec => rec.countbooklineid === item.countbooklineid);
           if (record) {
               record.memo_ud = newValue;
           }
           // Mark the form as having unsaved changes
           this.page.state.enablesave = true;
       }
    }



    ------------------------------
    Stacy Yeater
    ------------------------------