Manage Learn to apply best practices and optimize your operations.

Add a doclink using @commands

Add a doclink presenting any document within any view within any Notesdatabase into a document's rich text field.

This code can be used to add a doclink presenting any document within any (eventually categorised) view within any Notes database into a document's rich text field.

In this example a picklist is used to present the user a view of the documents, from where a doclink should be made. In the involved view the returned second (hidden) column contains concatenated info, from where for instance the subject of the doclink can be extracted. This can be put into a accompanying field next to the doclink, to give a description of the doclink. From the concatenated info the documents UniqueID can be extracted, which is used as a key for a (hidden) view, where the first column is sorted on the formula @Text(@DocumentUniqueID). Using the documents UniqueID as a key this view is opened temporarily on the desired document, which is loaded into the clipboard using the command @Command([EditMakeDocLink]) and closed. One would expect that the code @Command([EditGotoField]; "LinkOrganigram")=(name of the richtext field) and @Command([EditPaste]) will do the finishing touch: the pasting of the doclink into the desired field. However this will not function, since Notes does not conduct code in the order one writes it: when doing so the doclink is not placed into the field, but an error message is given indicating that a doc link cannot be paste into a view.

There are two solutions for this:
1) By adding a code for calling an agent, the involved view is closed, and the code into the agent will add the doclink to the desired field.
2) Using @PostedCommand code: @PostedCommand functions execute in sequence with each other after all other @functions execute

 server :=""; database :=""; file :=""; view :="Organigram"; title :="Make a choice"; prompt :="Select the organigram of the involved department:"; column :=2; newinstance :="1"; temporary :="1"; key :=@PickList( [Custom] : [Single] ; server : file ; view ; title ; prompt ; column ); orgaan :=@Right(key;"~"); unid :=@Left(key;"~"); @SetField ("Organigram";orgaan); nwview := "UNID"; @Command([FileOpenDatabase]; server : database; nwview ; unid; newinstance ; temporary ); @Command([EditMakeDocLink]); @Command([FileCloseWindow]); solution 1: @Command([ToolsRunMacro];"paste") code of (hidden) agent (Name: (paste) | paste , manual, run once) @Command([EditGotoField]; "LinkOrganigram"); @Command([EditPaste]) solution 2: @PostedCommand([EditGotoField]; "LinkOrganigram"); @PostedCommand([EditPaste])

Dig Deeper on Domino Resources - Part 2



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...