Whenever I need any sort of help in designing web form or css or even need to bring something hybrid, I do follow following useful articles . Hope these will helpful to others too.

1- CSS-Based Forms: Modern Solutions

2- Top 10 CSS Table Designs

3- 10 Useful Techniques To Improve Your User Interface Designs

4- 170+ Expert Ideas From World’s Leading Developers

5- AJAX, DHTML and JavaScript Libraries

6- 80+ AJAX-Solutions For Professional Coding

7- Pagination Gallery: Examples And Good Practices

8- Data Grids with AJAX, DHTML and JavaScript

9- 53 CSS-Techniques You Couldn’t Live Without

10- 75 (Really) Useful JavaScript Techniques

Few months back I was working in SharePoint designer and noticed it provides plenty of tools and easy way to deal with your web page structure,JS, CSS and other DOM models . You can easily identify which styles are applied, which are overridden and even structure of your inline styles. I must say people with no experience on web can develop web pages using SharePoint designer :-) . On the other hand when we do web development in Lotus Notes ( prior to R8.5 release ), I must say most of the developers either write CSS/JS in some web editor (I prefer EditPlus) or copy from some cool website using URL manipulation. I do most of the time :). Recently I had found free web tool which is quite cool as more or less like SharePoint. It's called Firebug , which can be used as a add-ons with Mozilla.You can just download it and open any website in Mozilla and go to Tools->Firebug and Choose options.

What can you do with Firebug ?

1- You can inspect HTML of the page. Shown below ,



2- You can inspect CSS or even can steal CSS from any site without doing any URL manipulation :)



3- Inspect JS files



4- Find out which styles are overridden , DOM structure and even layout



It makes my web development really easy without distracting much towards Microsoft tool ;-). Just visit Firebug and see what more you can do with it.

Today I encountered something interesting, It was small but yet to gave me some challenge. In one of the web form we have Dojo text area. What we found while testing if user copy-paste some contents from MS word/excel contents get truncated or even impossible to read.Something like,



But if you just close and re-open the document , everything looks perfect. here it is,



Now what could be easy to implement solution without doing much changes from ground. What I thought lets create one button next to the existing "text Area" field say "click to paste". It will open a dialog box with another "text area" field which will allow to write or paste the contents from various sources.Once done you can click OK and dialog box's contents moved to the original text area which is in read only mode.It could be much simpler if you have just a text field or something to pass via Query String. After little mind-boggling I was able to fix this. Here are the logic.

Lets assume my original text area field name is "Body_1". So, Following code is implemented on "Click to Paste" button (which is mentioned on the top) ,

var childWin;
var pData
childWin=null;

if ( document.getElementById('Body_1').value != "" ) {
childWin=window.open('server/db/form?OpenForm','popup','status=0,toolbar=0,scrollbars=0,resizable=0,width=500,height=145,top=500,left=550')
}
else {

window.open('server/db/form?OpenForm','popup','status=0,toolbar=0,scrollbars=0,resizable=0,width=500,height=145,top=500,left=550')

}

Next, Lets assume our dialog box's field name is "Body". Here is the code which is written on "onLoad" event of the dialog box to retrieve parent's value ,

document.getElementById("Body").value = window.opener.document.getElementById("Body_1").value

At the end here is the code which will set Child form's field contents to parent ,

var pData= document.forms[0].Body.value
window.opener.document.getElementById('Body_1').value= pData
window.close();
window.opener.document.getElementById("btnPaste").value="Click to Edit"

Lets see all steps in image ,

Step 1- When form loads ,



Step 2 - Clicked on "Click to paste" to paste the contents ,



step 3 - Last step to edit the text again ,



Simple and easy to use , right :)

Few days back I had requirement to build dynamic DHTML menu based on the user's personal configuration document. Initially I thought to build everything in JS to avoid any mess up.But after getting the final specs I found , I need to build the menu based on the existing menu which is on flash.Funny thing was I don't have any knowledge about "Flash", moreover existing flash menu was horrible than my expectation.However it was quite good to see something new which I have never done. I had started looking the whole menu structure in and out and able to understand what actually they have done.Anyways, It's quite complex to explain flash menu stuffs in notes, probably will write separate blog for that. Come to the point , How @For had spoiled my few hours :-)

After getting the logic I had decided to build menu using HTML LIST tag and apply mouseover effect so that it gives button kinda effect when menu generates .In few hours I finished the menu part which was getting generated quite well on the image which was actually the company logo(theme).




Now my next step was to create LIST tag in loop, something like

LIST START
For (i =1 ; i <@length(menu_title) ; i++)
[menu_title[i]]
LIST END
Since I was retrieving logged in user's configuration contents using @formula so I thought lets try formula to build the menu. I had created three fields , one to build menu contents (something like menu_title^menu_url) , second to keep only menu title and third to keep only menu url.See the snippet,



I was confident enough to wrap up in few minutes. Next I have designed the skeleton for my menu on the form and applied css and other logic to build the menu.Here was the final design,



I put following formula for Computed Value



Saved the form and boom... When I checked the output on web, found printed "1"..
I felt really strange what I have done wrong ..Checked the code so many times but didn't find anything wrong in the code. Thanks to "Kerr" (one of the member from Lotus Site) help me to find out what silly I have done in my code.. I just forgot or missed to save the tag information in temp variable.. It should be something like ,



You know what when I checked the help file it was mentioned in one of the example , but I just missed the point :(

Hope next time me or anyone who read this will not forget which I did :)

What could be the more efficient and easy way to trace your errors in Lotus script? We often use following statements to do error handling in lotus script,



This gives following results if error occurs,



But we can use better and more descriptive way to do error handling, something like,



This gives following results if error occurs,



You can find the difference.But don't forget to include "%INCLUDE "lsconst.lss"".

Even you can do more if you play around with following table ,



Pass any of the LSI_ constants from the table below to GetThreadInfo to have it return the current value of that constant.

Couple of days back one of my friend asked me about data integration methods in domino. He was quite confused to select suitable tool on real time situation.Domino provides various methods and connectors for data integration.In practical there are slight confusion between Lotus Script methods which access back-end data and Lotus connectors. Here are brief about connectors and methods which may give clear picture to beginners.

What is Connectors ?

Connectors are the Lotus standardized data-integration interface for connecting to back-end enterprise data via predefined connection formats. Connectors provide links from Notes and Domino applications to DB2, Oracle, SAP, JD Edwards, PeopleSoft, OLE (for MS SQL Server 7), MQSeries, and ODBC data sources. Connectors are used by Domino Enterprise Connectivity Services (DECS), Lotus Enterprise Integrator (LEI), Lotus Connector LotusScript Extensions (LC LSX), and Lotus Connectors (LC) for Java.

IBM has also developed connector APIs that are customized for IBM hardware and software platforms. MQSeries and CICS have connectors that work with specific tools. MQ Enterprise Integrator (MQEI) supports batch-style replication with MQSeries and CICS. MQSeries can also be accessed from LotusScript if you use the MQSeries LotusScript Extensions (MQ LSX). DB2 has its own LotusScript Extensions that work well with the DB2 connector, and IBM has published a native DB2 JDBC driver as well.

How Connectors work ?

Connectors make multiple data formats look the same to a Domino application. Notes and Domino applications can call seven classes when using a Lotus connector to access back-end data. Here are brief of those connector methods

LCSession :: Every connection contains a session object. LCSession provides information about available connectors and associated properties and methods. LCSession also handles any errors that occur during a connection.
LCConnection :: LCConnection connects and sends queries to the back-end data.
LCFieldlist :: LCFieldlist creates a block of field names through an LCConnection to create a result set or to write to a back-end data source.
LCField :: LCField stores the data type of a field for all values in an LCFieldList.
LCStream :: LCStream is a unicode text and binary data type, including the character set of the data.
LCNumeric :: The LCNumeric class contains numbers and is compatible with Domino number field formats.
LCCurrency :: The LCCurrency class supports a 19-digit, four-decimal numeric data format, and is the same as the Domino currency data format.
LCDatetime :: The LCDatetime class contains date time formats and is compatible with Domino date and time field formats.

Lotus Enterprise Integrator
Lotus Enterprise Integrator (LEI) is a tool sold separately by IBM that replicates between Domino and back-end sources in batch. Originally called NotesPump, it contained the real-time capabilities now present in Domino Enterprise Connectivity Services (DECS). When Domino 5 was released, DECS functionality was replicated and is now included as part of the Domino server. DECS also provided the base functionality for Domino 6 Data Connection Resources (DCRs).

LEI still contains real-time tools for data integration, but is mostly purchased and used for batch-style data transfer and replication. Aside from the tools to make data integration possible, LEI also includes a data-integration UI for managing replication. LEI is also useful for replicating data between two Domino databases that are not replicas.

LEI supports LotusScript integration via LEI LotusScript Extensions (LEI LSX), and supports Java functionality via Lotus Connectors for Java.

LotusScript Data Objects

LotusScript Data Objects (LS:DO) uses Open Database Connectivity (ODBC) to connect directly to back-end data from a client or a server. Queries and results pass between the client and the data source via ODBC.

LS:DO features

A set of LotusScript Extension (LSX) files enable functionality for LS:DO. The LSX files are loaded as DLLs in the Notes client and/or Domino server program directory. LS:DO uses Open Database Connectivity (ODBC) to connect back-end data sources to LS:DO classes in a Notes or Domino application. LS:DO contains three LotusScript classes, which differ slightly from their Lotus connector class counterparts.

Lotus Connector LotusScript Extensions

Lotus Connector LotusScript Extensions (LC LSX) use Lotus connectors to connect to back-end data from a Notes client or a Domino server. Queries and results pass to and from the client to the data source via the Lotus Connector's LCConnection class.

Lotus Connectors for Java (LC for Java)

Lotus Connectors for Java (LC for Java) use Lotus Connectors to connect from Java applets, applications, and servlets to back-end data from a Notes client or a Domino server. Queries and results pass to and from the client to the data source via the Lotus Connector's LCConnection class

DECS (Domino Enterprise Connection Services)

DECS stands for Domino Enterprise Connection Services.The purpose of DECS is to provide a Notes application with the capability to access, create, update, and delete data from an external database. The major restriction of DECS is that it's incapable of providing a Notes application with ongoing synchronization of data that has been added to or deleted from the back-end database through processes other than the Notes application.

The engine for DECS is a separate server task. This process runs on a Domino server, intercepting requests for the external data and fulfilling those requests.DECS is not only a server process; it also contains a Domino database for setting up and administering the connections and retrieval of data. This database is known as the DECS Administrator database, and it's created when you install DECS.


DCR (Data Connection Resources)

Data Connection Resources (DCRs) are new in Domino 6. They permit DECS to be extended directly into Domino forms. There are four major areas that must be set up to implement DCRs

>Database properties
>Data connections (under Shared Resources)
>Form properties
>Field properties

I had briefly mentioned all the methods and connectors which can be use in Domino to access back-end data.In the next blog I will write steps to implement,advantages and disadvantages for each methods.

I always thought that "Deny Access" was the be-all, end-all. But apparently not. If someone is listed in both the "Full Access Administrators" list and the "Deny Access" list for the server, they will still be able to access the server. The "Full Access Administrators" trumps the "Deny Access" setting.

From the Administrator Help file, here's information on the Full Access Administrators field:

Full access administrators

Full access administrator is the highest level of administrative access to the server. The full access administrator feature replaces the need to run a Notes client locally on a server. It resolves access control problems -- for example, such as those caused when the only managers of a database ACL have left an organization.

Full access administrators have the following rights:

* All the rights as listed for all administrator access levels (see above).
* Manager access, with all access privileges enabled, to all databases on the server, regardless of the database ACL settings.
Note ACL roles must still be enabled manually for full access administrators. Manager access, with all roles and access privileges enabled, to the Web Administrator database (WEBADMIN.NSF).
* * Access to all documents in all databases, regardless of Reader names fields.
* The ability to create agents that run in unrestricted mode with full administration rights.
* Access to any unencrypted data on the server.

Note Full access administrator does not allow access to encrypted data. The use of the specified user's private key is required to decrypt documents that are encrypted with public keys. Similarly, a secret key is required to decrypt documents encrypted with secret keys.


Obviously, you want to be careful with who is placed in that field. But when someone leaves the company, just putting them into Deny Access won't be sufficient. You have to pull them out of the Full Access Administrators field in addition to putting them in Deny Access.

I always get the complaints from the user saying being a manager I can't edit the document(s) which are created by other members.I always explain them , This is how Quickplace works.Quickplace shows "Edit" button to Author of the document or for those who are listed as "Additional Editors" section in the document.Yesterday, One of my user asked me to allow all AUTHORS and MANAGERS of the Quickplace to edit all the documents in the Quickplace.It could be only possible if you are writing your own LS code which executes manually or on schedule basis.Here was my solution , which worked fine and user got smile too :)

1- Open the Quickplace in Lotus client (It will depend on your requirement which room
you are going to implement this solution, I assume its main.nsf)

2- Write a LS agent which will take all documents handle from "h_Index" view (h_Index
only shows user documents)

Set view = db.GetView("h_Index")
Set entryColl=view.AllEntries

(I prefer entryCollection Class , Because it gives you better performance)

3- Checking whether document is "Published" or not. We need this checking because we
can't run the code which modify the personal draft documents.
You can use "h_PageCmd" field to check whether document is in draft mode or not.It
may contains three possible values , "h_MakeDraft" , "h_Publish" and
"h_MakeDraftFromPublishedVersion".

If doc.HasItem("h_PageCmd") And (doc.GetItemValue("h_PageCmd")(0)="h_Publish" Or doc.GetItemValue("h_PageCmd")(0)="h_MakeDraftFromPublishedVersion" ) then

4- Next, We have to get document's Author field handle.In my situation, I had
requirement to stamp all authors and managers of the main.nsf ACL.

5- Use NotesACL and NotesACLentry class to make list of desire authors and managers.

6- Update those Authors/Managers list to "h_Authors" fields of the document.

7- Save and close the document , go to the next document handle.

Today while working on one of the requirement my LS agent thrown the warning saying "In order to do multiple transactions simultaneously,you can't use the same db handle".But, Agent execution doesn't effected.I was curious to know why it has happened, I started my agent again to reproduce the warning.I noticed, I haven't disable the view autoupdate property to false, Could be the reason ? Still I don't give assurance to myself ,What went wrong.
Since my code was taking two different database handle , I suspect delay in releasing first database handle might cause the problem.But who knows ?????
But, Such situation can be avoided if its coming frequently with complex code.Here is the possible solution.

1- Disabled view autoupdate property.

2-

In the view's (Globals) section:

Option Public

Use "libSendKeys"

Declare Function GetForegroundWindow Lib "user32" () As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (Byval hwnd As Long, Byval lpString As String, Byval cch As Long) As Long

Dim nt As NotesTimer
Dim lHwnd As Long
Dim lCurHwnd As Long
Dim sText As String * 255

Sub handler(nt As NotesTimer)
Dim sCurText As String * 255
Dim i As Integer

lCurHwnd = GetForegroundWindow
If lCurHwnd <> lHwnd Then Exit Sub
i= GetWindowText(lHwnd, Byval sCurText, 255)
sCurText= Trim(Left$(sCurText, i))
If sText<>sCurText Then Exit Sub
Print Now
Call PushKeys("{F9}")
End Sub

In the view's (View) section:

Sub Postopen(Source As Notesuiview)
Dim i As Integer

lHwnd = GetForegroundWindow
i= GetWindowText(lHwnd, Byval sText, 255)
sText= Trim(Left$(sText, i))
Print "ActiveWindow: " + sText
Set nt= New NotesTimer(10)
On Event Alarm From nt Call handler
nt.Enabled= True
Print "Enabled"
End Sub

As I personally feel its not very easy to rectify replication problems in Lotus Notes.Moreover when it comes to Developers,It is more puzzled :).I always care few important points in replication either for database or documents level problems.Here they are :

Why are deleted documents reappearing?

A purge interval prevents replication of deletions
When a document is deleted, it leaves behind a deletion stub. When the database replicates, the deletion stub is used to identify and delete the same document in the replica. To save disk space, Notes purges deletion stubs that remain from document deletions according to the replication setting "Remove documents that have not been modified within the last [ ] days." If Notes purges the deletion stubs before they have a chance to replicate, deleted documents can reappear after the next replication.

A document edit writes over a document deletion
When the same document is modified on different servers between replication sessions, the "winning" document is the one modified most frequently, or if both are modified only once, the winner is the one modified most recently. If a document is edited multiple times on one server and deleted on another server between replication sessions, the edited document "wins" because it underwent the greatest number of changes, even if the deletion was the most recent change. If somebody deletes a document on one server and then someone else updates the document on another server once between replication sessions, the edit overrides the deletion because both documents were updated once and the edit occurred after the deletion.

Why are replicas different sizes?

Replication settings
Some replication settings cause one replica to receive only a subset of documents and features from another replica.

Access control list
The access control list (ACL) prevents a replica from receiving all documents or design elements from a source replica.

Read ACLs or reader names fields
A destination server isn't included in a Read ACL or Reader Names field and therefore doesn't receive all documents from a source server replica.

View indexes
A view is used in one replica but not in another; the replica containing the unused view is smaller because no index is built for the unused view.

Personal agents, views, or folders
These features used on one replica, but not another, can cause a size disparity between the replicas.

Deletions not replicated
The replication setting "Do not receive deletions" or "Do not send deletions made in this replica to other replicas" is selected.

Unused space
One replica has been compacted while another hasn't.

Why are unexpected deletions occurring in a replica?


You can prevent a database from receiving deletions made in other replicas by selecting the replication setting "Do not receive deletions." You can prevent a database from sending deletions by selecting the replication setting "Do not send deletions made in this replica to other replicas."

Unexpected deletions may also occur for any of the following reasons:

There is a new replication formula in place
A new replication formula overrides previous formulas and removes documents that don't match the formula.

A replication setting is automatically removing older, unmodified documents
The replication setting "Remove documents not modified in the last [ ] days" removes older, unmodified documents. If the specified number of days is low, consider increasing the value.

Why aren't deletions replicating?

Servers don't have adequate access to the database
To receive document deletions, the ACL on a destination server replica must give the source server Editor access or higher and have "Delete documents" selected.

A replication setting is preventing deletions from replicating
A source server doesn't send deletions to another replica if the replication setting "Do not send deletions made in this replica to other replicas" is selected. A replica doesn't receive deletions if the replication setting "Do not receive deletions" is selected.

Why can't I change which documents are replicated to my local drive?

To change which documents are replicated to your local drive, click the replica, choose File - Replication - Settings, click the Space Savers icon, and select the options you want.

Why can't I limit the documents I receive when I replicate?

To limit the documents you receive when you replicate, click the replica, choose File - Replication - Settings, click the Space Savers icon, and select the options you want.

Why can't I replicate?


Database-related issues
No changes have been made recently. Replication only occurs when there are changes to replicate.

The database is not scheduled to replicate. Check schedule replication .

Replication is temporarily disabled. To enable replication, choose File - Replication - Settings, click Other, and deselect "Temporarily disable replication."

The replica IDs are not the same. (Databases with different replica IDs cannot replicate.) Examine the replica ID for each database and make sure they match. If the replica IDs don't match, create a new replica and then clear the replication history on any other replicas to ensure that the next replication is a full replication.

The access control list on one of the replicas may have changed since the replicas were created so that you no longer have the same access level to both replicas.

Server-related issues
A server doesn't have sufficient access in the access control list of one of the replicas. Check that the access control list for each database gives sufficient access to servers. See About server access levels and replication .

The consistent access control list option is preventing replication. The message "Replication cannot proceed because cannot maintain uniform access control list on replicas," indicates that the "Enforce a consistent Access Control List" option has been set on a replica but the server storing the replica doesn't have the Manager access required to replicate the access control list. Give the server Manager access.

A server doesn't have access to a directory link. If a source server uses a directory link to point to a replica, the destination server must be given access to the directory link in order to receive changes.

There is a server or network problem. A variety of server conditions can prevent replication including mistakes in Connection documents, servers that are down, hardware or software problems, and so on.

The destination server is out of hard disk space.

Why do I see the message "Database is not fully initialized yet"


A replica stub on a workstation hasn't been manually replicated
If users create replica stubs on their workstations and don't populate them with documents according to a schedule, they must manually replicate to populate the replica with documents.

The server storing the replica stub doesn't have adequate access to pull information
If you rely on scheduled replication to populate a replica stub, the server storing the replica stub must have at least Reader access in the source server replica ACL to pull the documents from the source server.

An appropriate connection record between two servers isn't in place
If you rely on scheduled replication to populate a replica stub on a server with documents from a replica on another server, a correctly-configured connection record must exist between the two servers storing the replica and the replica stub. Confirm with your Notes administrator that an appropriate connection record exists.

Replication is disabled
Notes cannot populate a replica stub if replication is disabled on the source or destination server replica. To see if replication is disabled, select the database icon, choose File - Replication - Replication Settings and click the Other icon.

Why does a new replica contain the access control list of the source server when I didn't copy the access control list?


Somebody modified the access control list on the source server before initial replication occurred
If you create a replica stub and somebody modifies the access control list (ACL) on the source server before initial replication occurs, the ACL on the source server becomes the most recent one and replicates to the replica stub. Simply opening the Access Control List dialog box on the source server replica and then closing it can cause this problem.

The server times are out of sync
If you create a complete replica immediately (rather than creating a replica stub) and the time on the source server is later than the time on the destination server, the new replica contains the ACL from the source server.

Why doesn't a replica database contain all the documents it should?

If none of the following explanations apply, try clearing the replication history.

Replicas are temporarily out of sync
If changes made to one replica have not yet replicated, the sizes of replicas may be different until replication occurs.

The source server has insufficient access
The source server access in a destination replica ACL determines what the destination replica can receive from the source server. Give the source server higher access in the destination replica ACL if necessary. The following message in the server Notes Log (LOG.NSF) indicates insufficient server access: "Access control is set to not allow replication."

You haven't included a destination server in an access list
Access lists allow only a subset of people and servers in the ACL to access documents. If such access lists exist, add the destination server to them in the source server replica. If the access list uses a role to define access, add the destination server to the role on the source server replica.

An intermediate server has insufficient access
If replication between a source and destination server occurs through an intermediate server, make sure the source and destination server replica ACLs give the intermediate server high enough access to replicate all changes.

Replication settings are filtering documents
Some replication settings acts as filters that screen out documents and features. Check the replication settings.

The server is out of disk space
Ask your Notes administrator if the server is out of disk space and if so, investigate moving a replica to another server or deleting databases on the server.

Older documents weren't replicated to a new replica
When the replica was created, the date specified for the replication setting "Only replicate documents saved or modified after ( )" is later than it should have been. Create a new replica with an earlier date specified.

Why don't changes to the database title replicate?

If the replication setting "Do not send changes in database title & catalog info to other replicas" is set on the source server replica, the title won't replicate. Deselect this setting to replicate a database title.

Why isn't a replica database receiving access control list changes?

To receive access control list (ACL) changes from a source server, the replica database on the destination server must give the source server Manager access and the source server must give the destination server at least Reader access.

Why isn't a replica database receiving design changes?


To receive design changes from a source server, the replica database on the destination server must give the source server at least Designer access and the source server replica must give the destination server at least Reader access.

Here they are. Feel free to let me know if something else you guys check in replication related problems.

why is it that sometimes there are documents not included during replication process?

In the Basics tab of the Database Properties box, there is a button "Replication History," which opens the window of the same name. The first time one server replica successfully replicates with a replica on another server, IBM® Lotus® Domino(TM) creates an entry in the replication history. The entry contains the name of the other server, as well as the date and time of the replication. Separate entries are created when a replica sends information and when a replica receives it. On each subsequent replication with a specific server, Domino updates the entry in the history to reflect the most recent replication.
Domino uses the replication history to determine which documents to scan for changes during the next replication. For example, if a database successfully replicated with the HR-E/East/Acme server 24 hours ago, Domino replicates only those documents that were added, modified, or deleted in the replica on HR-E/East/Acme within the last 24 hours.
Before replication starts between two databases, Domino checks the replication history of both databases to make sure that they agree. If they don't, Domino scans each document created or modified since the date specified in the "Only replicate incoming documents saved or modified after".

If a database doesn't replicate successfully, Domino doesn't update the replication history.

To resolve this ,Clear the replication history only as a last resort to solve replication problems. If you clear the history, during the next replication, Domino scans each document created or modified since the data specified in the "Only replicate incoming documents saved or modified after" setting on the Other panel of the Replication Settings dialog box. If you clear the "Only replicate incoming documents saved or modified after" setting, Domino scans all documents in the database. Scanning all these documents can be time consuming, especially over dial-up connections.

Yesterday I got a mail from one of the Notes developer from Notes Forum with below contents :

We recently upgraded our Notes environment from R5 to R7 and currently running to an issue with one of my workflow database. I have an 'Author' field which capture names, date and time when users approve/validate a request. This field stop working since when users validate requests with R7 Client.. If users approve a request with R5 Client, their names appear in the field.


I'm using the following code in the Terminate Event of the "Author" field. When users approve a requests, the approver name, date and time supposed to be appended to this field but it's blank now. Can you please help me modifying the code?


Sub Terminate
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument

Author = uidoc.FieldGetText ("Author")
RevApproval_a = uidoc.FieldGetText ("RevApproval")

If Author = "" Then
If RevApproval_a <> "" Then
Author = "Completed by " & session.CommonUserName & " on " & Format(Now(), "Long Date")
Call uidoc.FieldSetText ("Author", Author)
Call uidoc.save
End If
End If
End Sub


I don't have R5 client So, I was not able to test the code.But tested in R7 and it was not working (Can't check in debugger also because it doesn't work in Terminate event).When I analyze the code , I don't find anything wrong with that.In jiffy I modified the code and send back to that person , Since it was urgent request.My code was -

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument

uidoc.EditMode=True
Set doc=uidoc.Document

If doc.GetItemValue("Author")(0) = "" Then
If doc.GetItemValue("RevApproval")(0) <> "" Then
Call doc.ReplaceItemValue("Author","Completed by " & session.CommonUserName & " on " & Format(Now(), "Long Date"))
Call doc.Save(True,False)
End If
End If

After replying him, I thought to analyze the code and something has instantly strikes in my mind "Will NotesUIdocument works in terminate event?" I have tested his old code in some other event and it worked as he expected.It was very small thing , But skipped from my mind :(

Further more I thought to dig something more about Notes events, I found something useful for those who always skips small things , like me :)

* You not use Initialize for anything except agents, and not use Terminate at all

* Each object has a Declarations area where you can write non-executable statements that apply to all events in the object, and an Options area for statements such as Option, Use, UseLSX, and Const. Each document and view has a Globals area where you can write non-executable statements that apply to all objects in the document.

* Changes made to the current document in a PostOpen event are treated as default values. The document is not marked as changed. If the user closes the document at this point, the PostOpen changes are lost. You must explicitly save the changes, for example, with the Save method of NotesUIDocument, if you want to be sure they are applied.

But still a question, how to debug your code which is in "Terminate" event ?
I think only way "MSGBOX" :) , Anything else you guys know ?

preload preload preload