Creating a ‘context-sensitive’ help (Notes client)

Mostly providing a help function in a database is a step that comes long after an application has been put ‘live’.

In order to save myself a lot of design additions I created a context-sensitive ‘help’ function for application managers so they can add them later, when users come with the need for documentation.

The function I add on view- and formlevel wherever I think it might be handy in the future and is really easy to implement.

On a view or a form I add an action button with some @formula code.

On a view:

db:=@Subset(@DbName; -1);
@If(@IsError(@DbLookup(“”:”NoCache”;””; “(Help)”; @ViewTitle+”\\”+db;1));
@If(@IsMember(“[Admin]”;@UserRoles);
@Do(
 @Set(“tmpval”;@Prompt([YesNo];”Help module”;”There is no help for this view available. Would you like to create a new Help document?”));
 @If(tmpval;@Command([ToolsRunMacro];”(CreateHelpView)”);””));
@Prompt([Ok];”Help module”;”There is no help for this view available.”));
@Command([OpenHelpDocument]; “”; “(Help)”; @ViewTitle+”\\”+db))

On a form:

db:=@Subset(@DbName; -1);
@If(@IsError(@DbLookup(“”:”NoCache”;””; “(Help)”; Form +”\\”+db;1));
@If(@IsMember(“[Admin]”;@UserRoles);
@Do(
 @Set(“tmpval”;@Prompt([YesNo];”Help module”;”There is no help for this form available. Would you like to create a new Help document?”));
 @If(tmpval;@Command([ToolsRunMacro];”(CreateHelpDoc)”);””));
@Prompt([Ok];”Help module”;”There is no help for this form available.”));
@Command([OpenHelpDocument]; “”; “(Help)”; Form+”\\”+db))

If a user has the role Admin assigned it will enable to create a new ‘Help’ document for this particular design element.

If there is no ‘Help’ document available for this design element a popup window will appear:

help popup

When selecting ‘No’ the code will stop. When selecting ‘Yes’ an agent will run and creates the document on the background. A confirmation will appear:

help confirm

If the user hits the action button again the newly created document will appear in a new window, just like the normal client Help function would do. This enables the user to switch between the application and the ‘Help’ document.

If you add the Admin role in an Authors field on the ‘Help’ document they can edit the document via a double-click and add content to the document.

At least this function saved me a lot of time and surprised application managers that it was already there from scratch!

Here is the code for the agent:

Sub Initialize
%REM
———————————————————————————————————————
The next script runs when there is no help document available for this design element
The script will create a new help document
———————————————————————————————————————
%END REM
 Dim Session As New NotesSession
 Dim workspace As New NotesUIWorkspace
 Dim db As NotesDatabase
 Set db = session.CurrentDatabase
 Dim lookupview As NotesView 
 Dim uidoc As NotesUidocument
 Dim thisdoc As notesdocument
 Dim lookupdoc As notesdocument
 Dim kolldoc As notesdocument
 Dim kollview As notesview
 Dim newhelpdoc As notesdocument
 Set uidoc = workspace.CurrentDocument
 Set thisdoc = uidoc.Document
 Dim helpform As String
 Dim server As String
 Dim path As String
 
 path = db.FilePath
 helpform=thisdoc.Form(0)
 
 ‘Collect data from help view
 Set kollview = db.GetView( “(Help)” )
 key$ = helpform+” “+path
 Set kolldoc = kollview.getdocumentbykey(key$, True)
 If  kolldoc Is Nothing Then
  
  ‘Create a new help document
  Set newhelpdoc = db.CreateDocument
  newhelpdoc.form=”F-Help”
  newhelpdoc.Tx_About=”Instructions for: ” + helpform
  newhelpdoc.Tx_Databas=path
  newhelpdoc.Tx_Form=helpform
  saveres = newhelpdoc.save(True,True)
  If saveres Then
   var = Messagebox(“A help document has been created in the Help module.”+Chr(10)+Chr(10)+”Please test the connection via the Help button.”,0+64,”Help module”)
  Else
   var = Messagebox(“A Help document could not be created. Please check the connection to the Help module.”,0+16,”Help module”)
  End If
 Else 
  var = Messagebox(“A Help document already exists for this form.”,0+16,”Help module”)
 End If    
 
End Sub

Advertisements

3 thoughts on “Creating a ‘context-sensitive’ help (Notes client)

  1. Nathan T. Freeman 2007-May-18 / 2:49 pm

    I like the control via the Admin role, but honestly, if you popped in some versioning or maybe some simple response/approval capabilities, you could really be implementing Wiki-styled contextual help. Frankly, I consider that the Holy Grail of systems documentation

  2. quintessens 2007-May-21 / 10:41 am

    Hej Nathan,

    this is just ‘food for thought’, I guess a SnTT post is about, right? But I am happy to look forward to your Wiki-styled contextual help example 😉

  3. Zafar 2008-June-9 / 11:22 am

    Hey this is greate….
    Can you help me a little
    i have created a chm help file and wants to open it through a link and when the user press ‘F1’ key but it should run on the web.
    i had created a chm help file and inserted it into file resourse but when i click on the link it is popping a window asking for save, open and cancel options. i dont need this window to open i need when the user clicks on the link or press ‘F1’ key it should directly open the chm file window.
    please help me in solving this problem

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s