Use a view, not hardcore status values, with a workflow

View member feedback to this tip.

When working with a workflow, do not hardcode status values. Instead, use a view to maintain the status value pairs. The number of status is the benchmark for the workflow, and the workflow is bound to change over a period of time. Sometimes, due to some business processes, the status itself gets changed. In that case updating the status in the design as well the documents would a waste of time. So, making a master view for the same would be a better solution.

Make a Form named StatusMaster; make it hidden so only administrators could update the StatusMaster. Add two fields, statusCode and statusDesc. Now create a view, (StatusMaster|vStatusMaster) with two columns, statusCode and statusDesc. Make use of the StatusMaster form to create the status value pairs.

Now, whenever you need status description for a particular stage you can use the following code for the same:

 Returns the Status Description 
associated with the specified Status Code

  lookup the statusCode in the 
Status Master view
  get a handle of the document
  return the Status Description of the same
  if no document found, return blank

Public Function getStatusDescription
(strStatusCode As String) As String
 'Function to fetch the Status
 Description wrt Status Code
 On Error Goto errorHandler
 Dim vStatus As NotesView
 Dim dStatus As NotesDocument
 Dim strStatusDesc As String
 Set vStatus = gdb.GetView("vStatusMaster")
 If Not vStatus Is Nothing Then
  Set dStatus = vStatus.GetFirstDocument
  While Not dStatus Is Nothing
   If Cstr(dStatus.statusCode(0)) = 
strStatusCode Then
    strStatusDesc = Cstr
    Goto outOfLoop   
   End If
   'Fetch Next Document
   Set dStatus = vStatus.
 End If
 getStatusDescription = strStatusDesc
 'Close the handles
 Set dStatus = Nothing
 Set vStatus = Nothing
 Exit Function
 Call handleError
 getStatusDescription = ""
End Function

If you want to get the Status Description in Formula, use the following piece of code:


Also, in the agents or LotusScript wherever you need to update the status, update the statusCode instead. Keep a computed for display field on the form for vStatus (visibleStatus). You can make use of the above formula for this field.


Hi all. Please note that in the Lotus script function getStatusDescription , gdb is a global variable declared in the script library as follows:

Public gs as NotesSession
Public gdb as NotesDatabase

and is initialized with the current database as follows:

Set gs = New NotesSession
Set gdb = gs.CurrentDatabase

Also, in the formula given


The columnNumber would be usually 1. This number references to the column position in the vStatusMaster View for statusCode Column/Field.

—Sunil Vishwakarma, tip author

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip exchange by member Sunilkumar Vishwakarma. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our bimonthly tip contest and you could win a prize and a spot in our Hall of Fame.

This was first published in July 2005

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.