The treatment of \jobname in LyX 2.1.2 has changed compared with 2.1.0
-- although I'm having to rely on memory for that claim since I've
uninstalled 2.1.0. But some latex code that worked with 2.1.0 no longer
works with 2.1.2.
If you create a LyX document, call it test.lyx, and in it in ERT
write \jobname then compile to pdf, the pdf contains the word "test".
However if you wrap the ERT in a preview inset, it will snap into view
with some name like "lyxpreviewbT4684", although the pdf still compiles
to display "test". In other words, the preview is giving a false
preview. Unfortunately my code which was designed to work in preview
insets and used \jobname as referring to the wider document, fails as a
result. (Perhaps this is a consequence of the countermeasures to the
tabular bug in LyX 2.1.1?)
Andrew