I have a Screen Flow. There is one Screen Element containing a Lightning Web Component which is based on the standard lightning-datatable component, which allows the user to edit a set of records. These records are SObjects.
The LWC has three output properties of type @salesforce/schema/xx__Seniority__c[]
:
deletedSeniorityList
containing records to be deletedupdatedSeniorityList
containing records to be updatednewSeniorityList
- containing records to be inserted
All thee of these lists are being correctly set by the LWC according to the user's edits to the table.
All three are then copied into flow record collection variables (SenioritiesToDelete
, SenioritiesToInsert
& SenioritiesToUpdate
) for the appropriate SObject type.
When I debug the flow and make no changes to the table, the following debug details appear, which seem to be correct:
Outputs:
deletedSeniorityList = SenioritiesToDelete ([])
newSeniorityList = SenioritiesToInsert ([])
updatedSeniorityList = SenioritiesToUpdate ([])
(all empty, as expected, because no edits were made)
After the screen lement, there are theee more elements to perform the DML: Delete Records, Update Records, Create Records, each using the appropriate records collection variable.
The Delete Records operation fails with the following error:
DELETE RECORDS: Delete_Seniorities Delete xx__Seniority__c records whose IDs are stored in {!SenioritiesToDelete}.
Variable Values
None.
Result
Failed to delete records whose IDs are in {!SenioritiesToDelete}.
Error Occurred: No records in Salesforce match your delete criteria.
Why would this error occur if the list of records to delete is empty?