use of "Dear you" extension when there is no first/last name only email and custom name field
You can use Smarty in greetings handling.  So first - make sure you're using the "Email Greeting" or "Postal Greeting" token instead of the "First Name" etc. tokens.

Then you can do something like this:

{capture assign=ln}{contact.last_name}{/capture}{if $lm ==""}{contact.custom_1}{else}{contact.last_name}{/if}


See this blog post on greetings handling for more detail.

EDIT: This approach won't work if you need accented characters because of how Smarty works.  See https://www.dxsdata.com/2014/05/php-smarty-empties-strings-with-special-characters/ for details.