To give some context, I had the requirement that I needed to guide the users through a couple of screens when closing an opportunity.
So logically, I started implementing this requirement using visual flows.
One of the logic that the flow should do is check if the opportunity contained products. If not, the user should be able to still add the products at that time from the flow.
This seemed to work fine. I loaded the correct pricebook entry, let the user select the product(s) and have them enter a price. However, I still got an "unhandled exception".
After investigating the debug logs, I found out that the exception was comming from a validation rule.
I have this "Available for Buying / Selling" picklist on the Product object. On the opportunity line object, I have a picklist where they either choose buying or selling. The validation rule in question checks if the product added, was available for buying or selling.
The very strange thing is that when I add the same product through the normal "add products" that I don't get an issue with the validationrule. It's only via the flow that the validationrule fails.
It seems that if I'm going via a flow, that the field I'm trying to reach in the validation rule Product2.Available_Buying_Selling__c can't be reached. (I see that it's null in the debuglog, even though it is correctly filled with a value)
I don't have a clue where this issue comes from...