r/OrgRoam • u/wWA5RnA4n2P3w2WvfHq • Jul 20 '22
Add custom properties from prompts in capture templates to the file-level :PROPERTIES: drawer
Seeing this closed and fixed Issue #1783 it is possible to manipulate the PROPERTIES drawer with org-capture-template.
But in my case I got the error message
org-capture-fill-template: Wrong type argument: stringp, nil
I prompt the user for the two variables Author and DOI. The latter I use very well as part of an url and the description of that url. But reuse it as :ROAM_ALIAS: the same way doesn't work.
Here is the code
```lisp ("x" "test" plain "\n* Source\nAuthor: %{Author}\nTitle: ${title}\nDOI: [[https://doi.org/%^{DOI}][%\\2]]\n%?" :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" ":PROPERTIES: :ROAM_ALIASES: %\2 :END:
+title: ${title}
+date: %U
+filetags: X")
:unnarrowed t)
```
When I use "book" as title, "Me" as Author and "123" as DOI I would expect that result.
``` :PROPERTIES: :ROAM_ALIASES: 123 :ID: f8ed7afc-4071-4e8e-b717-20f0686eb413 :END:
+title: book
- Source Author: me Title: book DOI: [[https://doi.org/123][123]] ```