Agent with eachLink() not updating on my TB (version 9.2.1)

Continuing the discussion from Set link type automatically based on container of destination notes?:

I have a problem with an agent that is not updating. @mwra recently helped to figure out a way to automatically set link type based on the container of the destination note for links of a specific type. He created a “before”-document and an “after”-document (see below) and the agent executing the functionality worked on his Tinderbox. However, when I download and run his test document, the agent is not updating the link typ as expected. I made another agent in the document (changing the colour for notes with a specific name) just to test if there is something wrong with agents in general on my TB, but it worked as it should.

The query selects notes correctly
$TextLinkCount(original)>0

But the action code does not work on my TB
eachLink(aLink,original){ if(aLink["type"] == "*untitled" & aLink["destination"].contains("/Sources") & aLink["anchor"]!=""){ aLink["type"] = "reference"; } };

Could it be that I run on TB version 9.2.1? What else can it be? Please help!

eachLink()'s second, optional, scope argument was only added in v9.5.0. As your problem needs that extra argument this process can’t be run in versions older than v9.5.0. Before asking, I don’t think there is a way to do your task with an agent in v9.2.1. You might have to take a totally different approach, not using agent (or upgrade the app).

1 Like

Thanks @mwra! That’s it. Time to update TB. The functionality you put together is too good for my workflow to miss, now when I know that it is possible.

1 Like

Thanks, and a reminder that the present, i.e. v9.5.0+, eachLink() syntax is documented here.

I updated to 9.5.1 and it works like a charm, also in my actual document. Thank you so much!

1 Like