Skip to content

AB#134988 - If anything changes in certain fields (including document uploads), change a boolean value#2911

Open
Joselgc1 wants to merge 1 commit into
nextfrom
AB#134988
Open

AB#134988 - If anything changes in certain fields (including document uploads), change a boolean value#2911
Joselgc1 wants to merge 1 commit into
nextfrom
AB#134988

Conversation

@Joselgc1

Copy link
Copy Markdown
Contributor

Description

Adds a new SurveyJS trigger type, On field update. This trigger allows admins to configure one or more fields to monitor, a target question, and the value to set on that target question when a monitored field changes during record edition.

The trigger:

  • Runs only when saving an existing record through onComplete().
  • Does not run during initial record loading or new record creation.
  • Compares the final saved value against the value originally loaded for the record.
  • Does not fire if the user changes a value and then reverts it before saving.
  • Supports document upload fields.
  • Keeps existing SurveyJS triggers unchanged.

Useful links

Type of change

  • New feature (non-breaking change which adds functionality)
  • Improvement (refactor or addition to existing functionality)

How Has This Been Tested?

  • npx nx lint shared
  • npx nx test shared --testPathPattern=src/lib/survey/triggers --configuration=ci
  • npx nx test shared --configuration=ci
  • Manual UI testing in the form builder and record edition flow

Manual test steps:

  1. Open a form in the back-office form builder.
  2. Add a text field, a file upload field, and a boolean field.
  3. Add an On field update trigger.
  4. Select the text and file fields as fields to monitor.
  5. Select the boolean field as the target question.
  6. Set the value to true.
  7. Save the form.
  8. Create a new record with monitored fields filled and boolean set to false.
  9. Confirm the boolean remains false after creation.
  10. Edit the existing record and save without changing monitored fields.
  11. Confirm the boolean remains false.
  12. Edit the existing record, change a monitored field, then revert it before saving.
  13. Confirm the boolean remains false.
  14. Edit the existing record and change a monitored field before saving.
  15. Confirm the boolean becomes true.
  16. Repeat with document removal or replacement.

Screenshots

New On field update option under triggers:

image

Trigger configuration:

image

New record created with boolean set to false:

image

First name changed so now the triggers sets off automatically:

image

The target question can be configured for any other types of fields.

Checklist:

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-frontend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation (if required)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Joselgc1
Joselgc1 requested a review from AntoineRelief July 17, 2026 09:23
@Joselgc1 Joselgc1 changed the title AB#134988 - If anything changes in certain fields (including document uploads), change a boolean value. The Admin should be able to specify which fields will trigger the bool value change. AB#134988 - If anything changes in certain fields (including document uploads), change a boolean value Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant