0

I have a Platform-Event Triggered Flow which does the following:

  1. After insert of a Platform Event record...
  2. Get OpportunityLineItem records related to an Opportunity
  3. If the result of the above query was not null (i.e. at least 1 record exists), delete all the records from the Collection above, and then create new line items.
  4. If the result of the above query IS null, then don't try to delete any line items, just create new ones.

The problem: When testing this flow on an Opportunity record which has 1 line item, I'm getting the following error:

Error Occurred: The flow tried to delete these records: 00k2z000002co9wAAA. This error occurred: ENTITY_IS_DELETED: entity is deleted

There are 2 strange parts to this error:

  1. If the record doesn't exist (it doesn't - I checked the database), why was it queried in the Get Element and attempted to be deleted??
  2. The existing line item record that SHOULD be deleted by the flow has a completely different record ID. Where on earth is the record ID in the error even coming from?? -> 00k2z000002co9wAAA ... It's like some ghost record hanging around.

Notes:

  • There are some existing triggers on Opportunity, but none that will fire for this event as far as I can tell
  • There are no triggers or other automation on OpportunityLineItem
2
  • Please edit your post to include more info. Is this a record triggered flow? Is it "Fast Field Updates" or "Actions and Related Records"? Do you have any flows or other automation on Opp or OppLineItem? Oct 21, 2022 at 0:06
  • @DavidCheng I have updated the post with some more info, but to be honest I'm really just looking for someone to help me figure out how an ENTITY_IS_DELETED error could get thrown when attempting to delete a set of records that was just queried from the DB. The record doesn't even exist right now in the DB and I'm not hardcoding any IDs, so I don't understand why the Flow is even attempting to delete this non-existent record.
    – JustinF
    Oct 21, 2022 at 7:52

0

You must log in to answer this question.

Browse other questions tagged .