Names, Authors and Readers fields in web application
This tutorial is based on the following software environment.
Windows XP Professional, Lotus Notes Client 6, Domino Server 6, Internet Explorer 7
Create a new database in server Go to File–>Database–>New. Give the file name as test.nsf

Open the database in Domino designer. Create new form. In form properties set the Name as Employee
Create a table with two rows and two columns. In table properties set the width of cell as 2.0
Now enter text in left cells. Type Name in top left cell and Manager in bottom left cell.
Create two fields. First create a text field in top right cell. Name it as EmployeeName.Select type as Text in field properties.
Create Names field in bottom right cell. Name it as EmployeeManager. Select type as Names. In field properties control tab select choices “Use address dialog for choices”.
Create a new Action. Name it as Save&Close. Write the formula as
@Command([FileSave]); @Command([FileCloseWindow]);
Save the form.

We have to create a new view. Go to designer and you may see an untitled view already exists there. Open the view and name it as All in view properties. Create two columns with title as Name and Manager respectively. Select the column values as EmployeeName and EmployeeManager.
Create a view action. Name it as Create Employee. Write the formula as
@Command([Compose]; "Employee");

Now open the db in Notes client and create and save some documents. You may select Manager field value by looking in address book. Select any document in view, right click on it and select document properties. In fields tab you may see that EmployeeManager is saved as Names data type.

So far things are fine .Now open the db in browser. Ensure that http task is running. You may open the db by entering following url in browser
http://<server name>/test.nsf where you may substitute the server name with your server name or server IP address.
If everything is Ok you are taken to views listing page. Open the All views and create employee by clicking Create Employee action button.
Now you may note that EmployeeManager is a text input field with no option for address book lookup.

Ok! lets go to the real action. Go to domino designer. Open Employee form and create new field in bottom right cell just beneath EmployeeManager field. Name it as EmployeeManagerWeb. Select type as Dialog list. In field properties control tab select “Use formula for choices” and write the following formula in formula window.
temp:="":@Name([Canonicalize];@DbColumn("":""; "":"names.nsf"; "($VIMPeople)"; 1)+"/"); temp1:="":@Name([CN];@DbColumn("":""; "":"names.nsf"; "($VIMPeople)"; 1)+"/"); temp+"|"+temp1

The above formula fetches names information from names.nsf address book.
Now hide EmployeeManager field in web and EmployeeManagerWeb in Notes. You may do this by going to field properties Paragraph Hide When tab.
It’s always best practice to keep separate forms for web and notes environment. You may create two forms or load different subforms based on condition. Here we will create two forms for both environments.
Go to design pane and create new copy of Employee form.Write click and select copy then paste there. A new form design element is created with Copy of Employee as Name. Change it to Employee in form properties and save the form. Now you have two forms with same name as Employee.

We need to hide one form in Web and another in Notes. In design pane select first Employee form, right click and select design properties. Go to design tab and select Hide design element from Web browsers. Similarly hide the second form from Notes Clients.

Now open the first form which is hidden in Web. Write the following input translation formula for EmployeeManagerWeb field
temp:=@Name([Canonicalize]; EmployeeManager + "/"); @If(temp="/"; ""; temp)
Save the form and open the second form which is hidden in Notes. Write the following input translation formula for EmployeeManager field.
temp:=@Name([Canonicalize]; EmployeeManagerWeb + "/"); @If(temp="/"; ""; temp)
Save the form. Now create documents from both Notes and web environment. Check document properties and see whether EmployeeManager is saved as Names data type. Similarly you may do the same for Authors and Readers fields also.
Happy Domino development!












