Possible workaround for uidoc.Refresh or uidoc.Save from an embedded view

I saw a post on IdeaJam asking for a solution to this problem. The thing is: if you have an action button on top of an embedded view and this button tries to run code that refreshes or saves the uidoc (t.i. the document that has the embedded view on it), this will crash your client. This is exactly the situation I was in: I needed a refresh or save in the containing document after pushing the button Add Checklist: Embedded view My client crashed everytime I tried to use a uidoc.Refresh or uidoc.Save. I first tried to put the button above the embedded view, that way the code ran ok, but the problem is: how do you explain this to the user? All action buttons are located above the embedded view, except for one? “Is this a joke?”, he will ask. Then I tried to move all buttons outside the embedded view. New problems rised: my code didn’t work the same way, and I had to find new workarounds for this. Then I put the button on a layer: you can’t see it in the screenshot, but the first button is actually in a layer floating on top of the embedded view. Here’s a screenshot of it in Designer: Embedded view with button in layer in Designer However, this needs some tweaking if you want your user not to notice the difference with a real action button in an embedded view:

  • Positioning: I use 2 layers: one layer (the container) with autopositioning, and a second (contained) layer with fixed positions (I had to go through some error messages to position it right, but it’s doable). Also, I let a dummy action button (without any code behind it) to leave some open space for the button.
  • Color and style: I matched the layer background color with the color of the actionbar. For the style for Action Bar – Button Options, I used Display border – Never. The layer button is actually a hotspot, which resembles most to this kind of action button. I also added the icon in the layer.

I won’t say this is the solution to all problems, but it might solve some of these embedded view/uidoc related issues.


  1. Martin, glad you’re still kicking.
    I usually solve this problem by ‘Sending an F9′. Works only in Windows, as I use the win API.

  2. Thanks :-). Your suggestion is also a good one. I suppose you can also use it to send a CTRL-S. And indeed, a pitty it’s Windows only…

  3. Thanks for tip, but there is one big problem with these actions (if they are anywhere else than in the view), they cannot manipulate with documents selected in embedded view.

  4. Hi Ondrej,

    You should check out Nathan’s post: http://www.lotus911.com/nathan/escape.nsf/d6plinks/NTFN-6Z3R8C and Chris’s: http://interfacematters.com/2007/03/quick-tip-collapse-all-in-embedded-view.html – they use a trick (showing the view that is embedded in another frame of the frameset, and apparently, the unexpected behaviour seeems that it picks up the selections from the embedded view. Read their articles (I tried it myself, but I couldn’t get it to work, maybe I did something wrong there).


  5. I had the same problem and resolved it by using Call wk.ViewRefresh.


  6. And no Notescrashes then? And it refreshes the document that has the embedded view on it? If this is true, it’s a very easy way to solve this issue! Thanks!

  7. In my experience, the workspace.ViewRefresh does not refresh the document in which the view is embedded.

  8. Its is exactly true the wk.viewrefresh doesnt work on the embedded view, a turn around may be when opening the form, we need to should drive the focus on the embedded view and call the F9 function.may be you ppl try out …
    F9 function goes like this:

    Dim view As NotesView
    Dim views As Variant
    Declare Sub keybd_event Lib “user32.dll” (Byval bVk As Integer, Byval bScan As Integer, Byval dwFlags As Integer,Byval dwExtraInfo As Integer)

    Sub F9

    Const VK_F9 = &H78


    ‘Press and release F9
    keybd_event VK_F9, 0 , KEYEVENTF_KEYDOWN , 0

    let me know if this workss :)
    keybd_event VK_F9, 0 , KEYEVENTF_KEYUP , 0

    End Sub

    • How can I set the focus to the embedded view in postopen using lotusscript?



  9. I think I have a solution to this problem. At least the problem seems solved in my applications.
    It’s so easy it’s almost ridiculous! All you need to do is to use an agent instead of having the code directly in the view’s action button.

    To refresh the form containing the embedded view, follow these steps.

    1) Create a view action button. Code = @Command([ToolsRunMacro]; “(myagentname)”)

    2) Create the agent. Name = “myagentname”. Type = Agent list selection. Target = None. Code =
    Dim ws As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument

    Set uidoc= ws.currentdocument
    If (uidoc.EditMode = False) Then uidoc.EditMode = True
    If (uidoc.EditMode = True) Then Call uidoc.Refresh


Submit a Comment

Your email address will not be published. Required fields are marked *

86 − = 81

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>