Skip to main content

I'm creating a simple flow that lists all child accounts in a text field on a parent account. It works as it should, except for the logic path that tells it to remove a Child Account from the list if the parent account is removed from the lookup field on the child account. I have done a lot of debugging and have determined that there doesn't seem to be anything wrong with the flow. The correct logic path is triggering, and all the elements are being hit as they should. The issue seems to be with the Get Records element, which has filtering conditions that say 1. Parent Id equals {!$Record__Prior.ParentId} and 2. Id does not equal {!$Record.Id}

 

So in plain english: give me all records where the Parent Id is the same as it was before I updated it, and don't include the record I updated.  When I run the debug logs, however, Salesforce has the filter for {!$Record.Id} as some erroneous record that doesnt exist in the system, instead of the id of the triggering record. This causes the actual record ID to still show up in the query, since it isn't being filtered out, and thus the Account name still appears listed on the former Parent Account. 

 

My question is, why is it not filtering on the record Id? shouldn't {!$Record.Id}  return the same id as the one in the URL on the triggering record? No matter which record I test with, it still seems to just make up a non-existent Account id to use in that filter. Does anyone have any insight into why Salesforce is behaving this way? I have looked up every Id it has used to filter and none of them are real accounts. Do Accounts have ghost Ids or different versions of the same record or anything like that? I really don't understand why it's happening

6 respostas
  1. 6 de jan. de 2025, 22:10

    I believe so. Basically in the Test Builder component you "make" a record there and set the relevant field values. 

    You can't reference the actual "Test Account 1" because if you directly called that record 1) its values would likely change over time so your test assumptions would be break, and 2) that exact record won't exist in different environments. 

     

    Flow Tests still have their place, but they are not perfect. If you want thorough testing you really need to create tests with apex.

0/9000