Skip to content

Problem with triggers in QField layers #7006

@rbarbarin2107

Description

@rbarbarin2107

What is the bug or the crash? What were your expectations and what actually happened?

We are working on a project that requires adding a trigger to a layer after creating the GeoPackage using the QFieldSync plugin. This trigger is intended to automatically update a field whenever a feature is split, by incrementing the value of a field called particion by +1 for all resulting features that share the same id_recinto value. Surprisingly, the same trigger runs correctly when using QGIS instead of QField.

While this functionality worked correctly in earlier versions of QField (e.g., 3.5), newer releases (such as 4.0.5) no longer preserve this behavior. As a result, the triggers do not execute as expected after splitting features.

Steps to reproduce the issue

bug_report.zip
trigger_gpkg.sql

These are the steps to reproduce the issue:

  1. Enable digitizing mode on the layer named "muestra".
  2. Open a feature form and activate the Split Features tool.
  3. Split the feature twice.

After splitting, you will notice that only the original feature receives the correct "particion" value (in this case, 1), while the newly created features have a NULL value.

Version

4.0.5

Operating system name

Android

Operating system version

13

Reinstall QField

  • I have a fresh install of the latest QField version, but the problem persists.
  • Problem can be reliably reproduced, doesn't happen randomly.
  • Problem happens with all files and projects, not only some files or projects.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions