Dynamic mailto:

100 views
Skip to first unread message

Stobot

unread,
Feb 14, 2017, 8:41:14 AM2/14/17
to TiddlyWiki
Hello all,

I have a knowledge-base I'm putting together at work (TW5). What I'm trying to accomplish is a simple mailto: link at the bottom of these tiddlers that use the appropriate contact, based on the custom field "topic" as stored in a dictionary tiddler as a lookup.

For instance...

Tiddler name = "Performing Inventory Audit", topic (custom field) = MaterialCost
Dictionary tiddler name = Owners, first value = MaterialCost:te...@email.com

The pieces seem to all work, I just can't get them all together...
* [[Send email to contact|mailto:te...@email.com]] works
* {{!!topic} returns "MaterialCost"
* {{Owners##MaterialCost}} returns "te...@email.com"

I can't seem to get much further than that though...
1.  I can't figure out how to get the mailto: to work with anything other than hard-coded string
2.  I can't figure out how to do the equivalent of {{ Owners##{{!!topic}} }}

For #1 I thought I could do something like:
[[Send email to contact|mailto:{{Owners##MaterialCost}}]]
...doesn'twork

For #2 I thought for the second piece I could do something like:
\define mylink() {{Owners##$(topic)$}}

<$set name=topic value={{!!topic}}>

<<mylink>>

</$set>
...but that doesn't work.  

Any ideas? I'm open to restructuring. The benefit of storing the contacts in a Dictionary tiddler is that it'd be only one place to change contact email when people cycled out of the role. Many tiddlers will have the same "topic"

Jed Carty

unread,
Feb 14, 2017, 3:07:43 PM2/14/17
to TiddlyWiki
When in doubt, cheat. Try this:


\define MakeLink() [[mailto:$(address)$]]


<$set name=address filter=[[Owners]getindex{!!topic}]>


<<MakeLink>>


</$set>

Stobot

unread,
Feb 15, 2017, 9:59:05 AM2/15/17
to TiddlyWiki
Perfect! I didn't know about getindex - will have to read up on that. 

Thanks Jed
Reply all
Reply to author
Forward
0 new messages