Problem solve Get help with specific problems with your technologies, process and projects.

Creating and saving a $Links field in the back end expert Cregg Hardwick offers advice to a Lotus Notes developer trying to create and save a $Links field, and explains potential reasons for doclink failures.

I use the rtitem.appenddoclink method in LotusScript. How can I create and save a $Links field in the back end?

Readers should be able to trigger doc updates via an agent that runs on the Lotus Domino server. It works fine until you reopen the doc without running the script (the script shouldn't be run if nothing has changed in the source database). The doclinks are then lost and converted to dblinks, because the $Links field was never created and saved in the Unique Identifier after the LotusScript agent was run.

Can you please help me solve this?

I would have to see your code to understand what you are trying to do. You cannot create a $Links field directly. This is a reserved field that is created by Lotus Notes when you add doc links to a rich-text field.

It's not clear why this process is not working, nor why the doclinks are "Converted to dblinks". I don't recall having experienced that behavior. The only way I have seen AppendDocLink fail either raises an error at runtime, when the user clicks the link, or both.

So without seeing your LotusScript code, I can only point out the following caveats:

  • Make certain that both Lotus Notes databases have a default form and view. doclinks can fail in a number of ways if this is not true.

  • Prior to Lotus Domino R7, no changes to a rich-text field are visible in the UI until the document is saved, closed, and reopened. I doubt this is an issue here.

  • Verify that the "linkto" object you are passing to the AppendDocLink method is, in fact, a document. Since I have never seen a link fail in any way that does not raise an error, my guess would be that your LotusScript agent has a bug and is linking to the Lotus Notes database instead of the intended document. Because the method is not type-safe, this wouldn't raise any alarm bells.

Do you have comments on this Ask the Expert Q&A? Let us know.

Related information from

  • Learning Guide: LotusScript
  • FAQ: LotusScript
  • Reference Center: LotusScript tips and resources
  • Dig Deeper on LotusScript

    • Favorite iSeries cheat sheets

      Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...