2

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...

1 Answer 1

3

This isn't going to be a very good answer, but I figure hearing this may be better than nothing, so here goes.

In my experience with Flow, if some kind of field or update isn't hitting the record from the Flow, I probably did something wrong. This has happened to me a LOT, largely because I work with Flow a LOT, but I digress.

Flow is a huge, complex thing. The smallest variation can throw the whole thing off. I've seen cases where it wouldn't create OLIs, throwing errors saying that neither UnitPrice nor TotalPrice had been defined when I very specifically had defined UnitPrice and Quantity. To this day, I still do not know exactly how I fixed the problem, though I suspect it may have something to do with variable types.

My point is: try everything. Switch the order of things. Change variable types. Set up a dedicated screen element for debug that spits out Flow.FaultMessage along with other variables like Product2.Available_Buying_Selling__c, just to be SURE it's coming into the Flow right. Don't assume anything. Test everything. Field and object permissions should follow those of whoever is setting off the Flow, but even then, that's an assumption!

Hope this helps at least a little.

1
  • I thought flows was a pretty rigid thing but seems I'm wrong :). The thing is, the lines are created in the flow and the only thing you can basically set to link a line to a product is to use the pricebook entry ID. So... the line is correctly created and linked to the product (pricebook entry) if I disable my validation rule. But if the validation rule is enabled (no change in the flow), it seems to think that the line that is about to be created is not linked to any product. I'll fiddle around a bit with the steps and let you know.
    – KoenVM
    Feb 18, 2014 at 7:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .