Is better call a flow or code some APEX+Visual Force?

You are correct that Flow and custom code can accomplish nearly the same thing, in almost all cases.

To cite the Salesforce mantra: clicks, not code -- where you can, you should use a declarative tool before writing custom code.

A Flow allows an admin who is unfamiliar with writing Apex the ability to do some pretty complex operations without writing any code.

When you run into limitations of Flow, which you will, your next best option is usually custom code. Writing code is more expensive in terms of initial development and testing effort as well as in the long term maintenance for the business after the solution has been delivered.


Flows currently have some pretty serious flaws, including having a very poor execution time (better chance of CPU governor limit exceptions), being harder to optimize (better chance of SOQL or DML governor limit exceptions), and a Flash-based editor that actually makes it faster to write trivial pages in Visualforce and Apex.

However, Flows do not require unit tests, and are generally marginally easier to migrate between orgs, and allow you to mock up user interfaces ahead of time so you can visualize what your UI should look like without committing to writing any code. Also, it is typically easier to add Flows to Lightning than it is to add Visualforce to Lightning.

Saleforce's official recommendation, of course, is "clicks before code", meaning you should do as much as you can using configuration when possible, and hopefully one day the Flow engine and Flow editor will be optimized to the point of usability.

In the interim, I would recommend this advice instead: unless you're a competent developer, use a Flow instead of writing Visualforce. Flows are steadily becoming better, and with the "Death of Flash" around the corner, it's likely we're going to get a better editor in the future.

Visualforce will be a viable technology for the foreseeable future, but you're likely going to migrate to Lightning one day; using Flows means you can write components that can leverage Flows to appear as part of the native LEX, while Visualforce automatically requires additional work to support LEX.

If you're going to write code, consider learning Lightning instead, and leave Visualforce alone. If you would rather not like to write code, use Flows.