I am working on an assignment in which I developed a screen flow. The screen flow gets triggered with a "Create Invoice" button on the opportunity. When the user clicks the "Create Invoice" button, the flow launches, gets the Opportunity info using the recordId variable, gets the opportunity products info using the same recordId variable and then displays a screen with the list of opportunity products with a checkbox group component. So, the opportunity products will display as a related list with checkbox associated with them. The user can select 1 or multiple opportunity product records from the list and click on Finish. The flow will create an Invoice Header record (custom object) and creates multiple Invoice Detail records for each opportunity product selected. When creating the Invoice Detail records, the flow is also updating a checkbox on the opportunity product called Product_Invoiced__c. I have not bulkified this flow collection variables yet.
The initial "Get Records" on the opportunity product is fetching all opportunity products where OpportunityId == recordId (Opportunity) and Product_Invoiced__c == false. However, this is not working as expected.
I debugged the flow for an opportunity with 5 records for the first time and selected three opportunity products and clicked on Finish. As expected, the flow created one Invoice Header record and 3 Invoice Detail records. I could see that the checkbox Product_Invoiced__c is also checked for these 3 opportunity products.
I ran the flow again for the same opportunity. I expect to see only 2 opportunity products in the screen element of flow with the "Get Records" on opportunity product. However, the flow is displaying all 5 opportunity products. I am not sure why the flow is NOT considering the Product_Invoiced__c values.
Can someone help?