Hi everyone
I created a flow to control duplicate records, and I implemented the following configuration:
1. Read Data Operation:
{
"filter": {
"_and": [
{ "Ense": { "_eq": "{{ $trigger.payload.Ense }}" } },
{ "activite": { "_eq": "{{ $trigger.payload.activite }}" } },
{ "date_cours": { "_eq": "{{ $trigger.payload.date_cours }}" } }
]
}
}
2. Add Script Operation:(check_dup)
module.exports = async function(data) {
return (data.read_data.length > 0);
}
This script returns true if a duplicate exists.
3. Condition Operation:
{
"check_dup": {
"_eq": true
}
}
The issue:
Even when there is no duplicate, Directus still returns this error:
The following fields contain invalid values:
check_dup: The value must be true
It seems that Directus is requiring the value true even when the condition should evaluate to false (i.e., no duplicates found).
Question:
How can I properly set up the flow so that Directus only triggers the error when a duplicate exists, and allows the record to be created when there is no duplicate?
thank in advance

