Yes, it works on offline mode as well.
Kind regards,
Maycon Belfort
Original Message:
Sent: 1/24/2024 2:52:00 AM
From: Ritesh Ranjan
Subject: RE: Maximo Mobile datasource.update creates new records on Maximo
Hi Maycon,
Thanks for the info.
are you gonna use this feature in Offline Mode also? if yes, is it working in offline mode?
------------------------------
Ritesh Ranjan
------------------------------
Original Message:
Sent: Wed January 24, 2024 02:02 AM
From: Maycon Belfort
Subject: Maximo Mobile datasource.update creates new records on Maximo
Here is what I got!
It worked when changing from ds.update to ds.save. It adds the _buildid with the wpitemid and the _action: Change to the payload, so it's working now when updating an item.
This is working fine on RBA, but on mobile, it has a different behaviour. On my 2 data sources, I have to force the reload to update the data on the screen. Still, it was causing some glitches when trying to add new items or edit others, so I noticed that I had to clean my details data source before searching on it again (when opening the drawer) using ds.clearState(), ds.resetState(), and ds.forceReload(). It seems that after filtering the ds, changing the filtered item and saving it, it temporarily removed the other items, so when trying to edit a different item, it couldn't find it even after forcing the reload after the save.
I'll run more tests to certify it works, but it is likely solved.
Thank you, @Ritesh Ranjan and @Johnny Kubinhets Pedrozo, for your help.
------------------------------
Maycon Belfort
Consultant
BPD Zenith
Melbourne
Australia
Original Message:
Sent: Tue January 23, 2024 02:04 AM
From: Maycon Belfort
Subject: Maximo Mobile datasource.update creates new records on Maximo
Hi Ritesh
1. Yes, but not servrectrans. It is the planned services wpservices.
2. Correct.
3. The user will have standard services that were created on Maximo before WO was assigned to them and they must update the existing ones or add new ones.
------------------------------
Maycon Belfort
Consultant
BPD Zenith
Melbourne
Australia
Original Message:
Sent: Tue January 23, 2024 01:31 AM
From: Ritesh Ranjan
Subject: Maximo Mobile datasource.update creates new records on Maximo
Hi @Maycon Belfort,
Payload part looks fine to me. (X-Method-Override:PATCH and Patchtype: MERGE).
Help me to clarify few doubts:
- You are trying to have SERVICE feature similar to either MATERIAL or LABOR for creating a transaction record via sliding drawer??
- If yes, then you open a sliding drawer to add a new transaction/record for SERVICE??
- If yes, then what I am not able to understand that how or what you are trying to edit the saved record in SERVICE??
------------------------------
Ritesh Ranjan
Original Message:
Sent: Mon January 22, 2024 11:38 PM
From: Maycon Belfort
Subject: Maximo Mobile datasource.update creates new records on Maximo
Thank you, Ritesh and Johnny, for your input. Here is what I have:
UPDATE
After changing the log level to DEBUG, I can see this message on my console.
2024-01-23T06:16:37.733Z: [ WARN]: [techmobile]: [UI-InfiniteLoader]: Render Failure. We were told that we had 3 loaded items, but we only rendered 1 items. This could be a bug in the Datasource, or we might have been triggered to re-render before we have loaded the data.
------------------------------
Maycon Belfort
Consultant
BPD Zenith
Melbourne
Australia
Original Message:
Sent: Mon January 22, 2024 07:30 AM
From: Johnny Kubinhets Pedrozo
Subject: Maximo Mobile datasource.update creates new records on Maximo
Hi Maycon,
Try to put a new entry on your service json
href: serviceDs.item.href
I suspect, its creating a new record because api needs href reference
------------------------------
Johnny Kubinhets Pedrozo
Original Message:
Sent: Fri January 19, 2024 03:36 AM
From: Maycon Belfort
Subject: Maximo Mobile datasource.update creates new records on Maximo
Hi there!
I've added to my TECHMOBILE app a WPSERVICE datasources to display, add, and edit a service item from mobile. I've tried to copy the reportworkLaborDetailds, and reportworkLabords functionalities when adding and editing a labour transaction. However, when performing a datasource.update(wpservice,options), it creates a new record on Maximo.
Does anyone have an idea what is happening and why it is "duplicating" my item when trying to update it?
<maximo-datasource depends-on="woDetailsReportWork" id="reportWorkServiceDetailsDs" id-attribute="wpitemid" object-name="wpservice" relationship="showplanservice"> <schema> <attribute name="wpitemid" searchable="true" unique-id="true"/> <attribute name="siteid"/> <attribute name="orgid"/> <attribute name="itemnum"/> <attribute name="description"/> <attribute name="itemqty"/> <attribute name="vendor"/> <attribute name="company.name--vendordesc"/> <attribute name="unitcost"/> <attribute name="itemsetid"/> <attribute name="orderunit"/> <attribute name="linetype" /> </schema> </maximo-datasource>
// Update codelet serviceDs = evt.page.getDatasource('reportWorkServiceDetailsDs');let service = { itemnum: serviceDs.item.itemnum, itemqty: serviceDs.item.itemqty, description: serviceDs.item.description, unitcost: serviceDs.item.unitcost, orderunit: serviceDs.item.orderunit, vs_costtype: serviceDs.item.vs_costtype, vendor: serviceDs.vendor, vendordesc: serviceDs.vendordesc, vs_hirestart: hireStart, vs_hireend: hireEnd, linetype: serviceDs.item.linetype, linetype_description: serviceDs.item.linetype_description, anywhererefid: serviceDs.item.anywhererefid, itemsetid: serviceDs.item.itemsetid, wpitemid: serviceDs.item.wpitemid }; let option = { responseProperties: 'wpitemid, anywhererefid', }; try { this.page.state.useConfirmDialog = false; evt.page.state.loadingSaveService = true; evt.page.state.isSavedService = false; this.saveDataSuccessful = true; serviceDs.on('update-data-failed', this.onSaveServiceDataFailed.bind(this)); await serviceDs.update(service, option);
------------------------------
Maycon Belfort
Consultant
BPD Zenith
Melbourne
Australia
------------------------------