X-devonthink-item in URL field implicitly sets annotation?

When setting the URL field of item A to a x-devonthink-item:// URL of item B I noticed it also (silently) sets the annotation of item A to item B. At least if B is a text, markdown or RTF document. If B is another type it indicates that an annotation is set with the ‘snowflake’ icon - but it does NOT seem to be set.

This seems unwanted (or at least it is for me): URL targets and annotations are different things. One of the ‘unwanted’ things is that impllictly setting annotations means it also follows the ‘Move annotations automatically’ setting. This results in deleting the item B when I delete item A. I want this for explicit annotations, but not for implicit annotations.

Also it seems inconsistent: an annotation is only set when item B is text, markdown or RTF (as are the types for annotations) but not for other types. In other circumstances an icon is set, while no annotation is actually set - this seems a bug.

Personally I would prefer that setting a URL to an x-devonthink-item does not set an annotation (unless explicitly said to do so). Also - maybe this behavior could also be clarified in the documentation if this is indeed intended / wanted?

That’s intended to ensure compatibility to annotations created by the template of version 2.x.

Well, difficult to argue with backwards compatibility :slight_smile: Thanks for clarifying. Is it correct that items other than text, Markdown or RTF-items do not have this behavior? I’m using it to backlink extracted attachments to their original e-mails., so that should probably still work then.

Yes, only plain/rich text and Markdown documents can be annotations.

As an aside: this is probably a bug then. The snowflake icon appears when setting the x-devonthink-item as URL which references a non-annotation document.

The icon just checks whether there’s such a URL, it doesn’t check the referenced record as it might be in a closed database too.

I’m working somewhat more on this and am running into how this limits functionality. I want to be able to set an annotation (Markdown file) and use the URL field to refer to the original DT item. Technically this would be possible, but the current behavior means that when I set an annotation file, the URL field (which has the x-devonthink-item field) is cleared. I understand the need for backwards behavior, but could there be a way to changed this behavior if no backwards compability is needed?

EDIT: I just found out some (unintended?) behavior: if I add an annotation - it clears the URL field, but if I re-add the DT link to the URL field the URL field is populated again, but the annotation is NOT cleared…

That’s actually intended.

Okay - so then I assume a ‘workaround’ would be if I add annotations to items with an x-devonthink-item in the URL field, I should ‘save’ the original URL, add the annotation and then re-add the original URL (I would still prefer if this backwards behavior could be turned off, but at least this would be workable)

Actually I would recommend a custom URL field. Or what’s the purpose of the item link in the URL field actually?

The use case is extracting attachments from e-mails. I’m using the URL field with the extracted attachments to link back to the original e-mail. When using a custom URL field I’d lose the ability to quickly use the URL link on the top of a document to jump to the original item.