I don't think there is any recommended way. There was something in TODO, but it's not implemented.
Your command just lacks stream redirections to make dialog draw on terminal, but print answer to vifm's pipe:
:execute 'echo' '"'.term('dialog --inputbox foobar 20 20 2>&1 > /dev/tty').'"'