Start a new topic

Referential integrity on a Reference selection in a Form

I have a field that has a reference selection on it(Special Brand).  The reference selection is filtered based on a user entry on another field on the form(Brand).  For example:

image

image


If the user makes a selection for Special brand the value is held in the field:

image


The issue I'm facing is, if the user changes the first field(used to filter the reference selection) Brand in this case, the second field in invalid it breaks the referential integrity.  See below:

image


image


But if I hit the dropdown...

image


Is there a way to check the Referential integrity of the Reference selection when the filter field(Brand) is changed?


1 Comment

Hello Matthew, 


I can think of 2 things depending on what you want to achieve:

  • Either create an enricher that will nullify the "Special Brand" if its "Brand" is no longer the right one.
  • Or create a validation that will at least warn (and/or block) the user from pursuing the authoring if the brand's special brand is no longer the right one.


Here are more elements on how to do so.

I took a simple example of a main entity and 2 references (country and city).


Enricher option:

  • Create an enricher to nullify the reference (in your case "Special Brand"):

> Expression: "case when FID_Country <> City.FID_Country then null else FID_City end"

  • Call this enricher in your stepper in the form enricher section "on data change":


Validation option:

  • Create a validation to warn when the 2 references are not consistent:

  • Call the validation in the stepper whenever needed. It can be in form validations "on data change":

Or if you want to block the authoring altogether, you can activate it at "step transition validations" on "block":

Or directly in the validations on "block":


Hope that helps.

Login to post a comment