(defun insert-property(&optional p)
"insert PROPERTY value of pdftools link"
(unless p (setq p "TEST"))
(message "property passed is: %s" p)
(let ((pvalue
(save-window-excursion
(message "%s" (org-capture-get :original-buffer))
(switch-to-buffer (org-capture-get :original-buffer))
(message "retrieved property is: %s" (org-entry-get (point) p))
(org-entry-get (point) p)
)))
pvalue))
I don't think you needed any (insert x)
call for a start. I had a fiddle and came up with this just to satisfy my own curiosity. I hope it helps. I used org-capture.get and also (point) but maybe that's an alternative way.
Just "%(insert-property "TEST")%" in my capture template.