Is there a way in a smart rule to test if a string !== custom metadata?

I would like to test in a smart rule condition if a header item Zettel-ID in a markdown document is equal (or better: not equal) to a custom metadata field.

My use case/setup:

I have a template for wikilinks to fill certain information from the source document to the target document via placeholders. I control my Zettelkasten via a custom metadata ID.

Title: %@
Zettel-ID: %mdid%+
Keywords: 
Created: %SortableDate%-%hour%-%minute%-%second%


**Idee**





**Zitat**




***

**Quellen/Literatur**




**Weiterführende Fragen**


--- 


**Parent**


← [[%recordName%]]


**Folgezettel**


→ 


**Querverweise**


→

The ‘+’ in the Zettel-ID header is an indicator for me that the note is a ‘Folgezettel’ (following note) and I need to change it to a or 01 depending on the ID structure.

Then a smart rule focussing on my Zettelkasten group tests if a file has an empty ID custom metadata field, runs a regex Zettel-ID: (.+) on the header of the file (thanks for providing the hidden setting to set IndexRawMarkdownSource to true) and places the Zettel-ID of the header in the custom metadata field ID.

My issue

However, sometimes I am quite slow changing the +in the newly created Zettel-ID-header line. That means that my smart rule changes IDto Source-ID+ instead of the wanted ID.

What I would like to do

I would like to know if it is possible to set up a smart rule that – as a condition – scans text against the custom metadata: if Zettel-ID: (.+) !== %mdid% then %mdid = \1 or something like that.


EDIT: cleaned up the Zettel-template above
EDIT2: found an error in my request (equal/not equal). I am actually searching for a way to test against A !== B
EDIT3: In my initial request I used instead of !== to describe ‘not equal’. Changed that to the common nomenclature.

There is only conditional criteria.
The only conditional smart action is Chat - Continue if in DEVONthink 4 (which I would not use in this case, though you could). All other conditionals are handled in an Apply Script action in 3 or 4 or Script with Input/Output in 4.

However, sometimes I am quite slow changing the + in the newly created Zettel-ID -header line. That means that my smart rule changes ID to Source-ID+ instead of the wanted ID.

This is a workflow issue, not an automation one. What event trigger are you using?

Thank you! You are right, this is certainly a workflow issue. The triggers are the following:
Maybe I will just remove the sync-triggers and let the magic wait for the startups/quits to happen.