Draft form using entities in Collect doesn't retrieve updated entity lists after first sync

1. What is the issue? Please be detailed.
(I feel like I've seen mention of this somewhere, but can't find it quickly on the forum or in github. Please merge threads as needed.)

This only applies to draft forms.

For a draft form that reads from entity lists, if a list is updated after adding the form to the device, the draft doesn't see the changes (eg add an item / change an item / remove an item).

Resetting the form and redownloading doesn't fix this.

Deleting the form and scanning the QR again also doesn't fix this! (app cache reset in device settings not tried yet / remove and readd Collect also not tried)

Adding the form to a device that has never had it before after making the change to the entity does get the current version of the entity lists, but then making a subsequent change to them will not be shown on device.

Syncing the device after the entity list change does however change the 'Added on' timestamp, indicating that Collect has seen a change to the entity list. Syncing with no draft change / entity change doesn't change this timestamp, as expected.

Enketo shows the latest entity state.

2. What steps can we take to reproduce this issue?

  1. create a draft that selects from an entity list
  2. add draft to device, view select contents
  3. modify entity list, eg add a value / change a label
  4. sync device, note the change in 'added on'
  5. view select contents as unchanged.
  6. go to project management, reconfigure, check saved/blank/cache and reset, resync draft
  7. view select contents as unchanged.
  8. delete draft, readd draft
  9. view select contents as unchanged.
  10. add draft to second device, view select and see changes to entity in select.

3. What have you tried to fix the issue?
various tests above

I have found this when testing entity based forms - it is possible to check the logic of the form, but not the function of entity behaviour (create / update). So I have resorted to using a test project and publishing the forms within that environment so they actually work as expected with entities. This is how I found out that __id (entity id) is unique to the server not the project - I was trying to duplicate my entity list into the working project after testing.

It is one of the barriers to moving to entity based work-flows that would be nice to fix - if there was a way to ‘containerise’ the draft form and entity list that might help with the adoption process - so we can test things without having long-term consequences for the server. The proposed new Entity List and Property deletion features will help with this, but it still feels a little clunky. I guess that’s the joy of working at the bleeding edge (don’t read that as a profanity!).

I hadn’t spotted that Enketo does use an updated entity (I guess it’s not cached, so when you open the draft form it loads the entity list as it last stands?)

There’s a note on Central when editing a draft form:

This Form Definition creates or updates Entities. For now, Entities are not created or updated by Draft Forms, so you will need to publish the Form to verify Entity functionality. For more information, please see this help article.

This doesn’t solve the problem, the help article gives a bit of a workaround, but it does at least alert us to the current limitations…

No that's not the issue I'm seeing.

I know drafts don't create or update entities, in this case if i update the entity via a different method, eg a published form or direct edit in central and then sync the draft, the draft has an updated timestamp but it doesn't show the change to the entity.

1 Like

Many thanks for report. We can reproduce and are looking into it.

1 Like