Manage Learn to apply best practices and optimize your operations.

Field change agent

A LotusScript agent that prompts the FLS member for the field name to be zeroed out.

In my current job, I have to support multiple applications that I didn't design or develop. Some of them are great apps, but some of them have a few problems, too. One app I inherited didn't have validation for a large number of type 'number' fields, and users could delete the default zero and still save the document. When a user then tries to reopen the document, the cascaded computed fields bomb out and the document won't open. After I inherited the app I added validation to prevent this from happening in the future, but many, many documents have been saved with this problem, and they still surface from time to time.

Luckily, I have two things going for me here. First, I have a First Level Support (FLS) structure in place. These folks are my first line of defense for application problems. Second, I have R5, which is kind enough to tell me the exact field name that is having problems. I was fixing these fields manually with a simple formula agent that I would modify each time I needed it, but after the fifth phone call I decided to make a simple tool for the First Level Support folks to allow them to fix these fields without my help. It's a LotusScript agent that prompts the FLS member for the field name to be zeroed out. It checks to ensure that the field exists, and if it does, zeros it out.

This agent is very simple, and it has saved me hours in support calls. It can also be easily modified to increase functionality for other needs. The agent uses the NotesDocumentCollection class in the UnprocessedDocuments property of the NotesDatabase class. See the Notes Help files for more information on the specifics of this property.


When should this agent run?
Manually from Actions Menu

Which document(s) should it act on?
Selected documents

What should this agent run?
LotusScript

(Declarations)

Dim ns As notesSession
Dim ndb As notesDatabase
Dim ncol As notesDocumentCollection
Dim ndoc As notesdocument
Dim ni As notesitem
Dim fieldname As String


Sub Initialize
     
     Set ns = New notesSession
     Set ndb = ns.currentDatabase
     Set ncol = ndb.unprocessedDocuments
     Set ndoc = ncol.getfirstdocument
     
     'prompt the user for the fieldname to zero out...
     fieldname = Inputbox("Please enter the fieldname that you want to zero out:")
     Set ni = ndoc.getfirstitem(fieldname)
     
     'check to make sure the field exists
     If ni Is Nothing Then
          'it doesn't exist
          Msgbox("Couldn't find a field with that name. Try again.")
     Else
          'found a field with that name, so zero it out
          Call ndoc.replaceitemvalue(fieldname,0)
          Call ndoc.save(True,True)
     End If
     
End Sub

Dig Deeper on Domino Resources - Part 5

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchDataCenter

SearchContentManagement

Close