How to set new Reader name in existing Reader field using Lotus Script?

You can set reader name in existing document. For this you should have at-least manager/ designer/ editor /Author access to database.
From the script below check this function/method.
This is important method, only replace field values in existing reader field will not work , you have to explicitly set ‘IsReaders’ property as true
Now, look at the steps how to add Another Reader name to existing field.

Steps -
1)Create new agent / or button to write the lotus script
2)If you are working on agent add below script and select agent property ,run on only selected documents.
3)If you are working on button, create button on UI view and just copy & paste the below script on button Onclick event.
4)Save your code and open a view
5)Run the agent/or click on button to run the script , before this select the document from view where you want to add new reader field 

Sub Initialize
    Dim ws As New NotesUIWorkspace   
    Dim doc As NotesDocument
    Dim view As NotesView
    Dim uiview As NotesUIView   
    Dim doccoll As NotesDocumentCollection    
    Dim ReadItem As NotesItem
    Set uiview=ws.CurrentView
    Set doccoll=uiview.Documents
    Set doc=doccoll.GetFirstDocument 
           'Selected document, script runs on single document only
   If Not doc Is Nothing Then        
   Set ReadItem=doc.GetFirstItem("NewReaders")
 ‘New reader field, you can use existing reader field if you have reader field already created on form
        If Not ReadItem Is Nothing   Then           
            Call ReadItem.AppendToTextList("Amol Jalak/EXTNEW/US/MAIL")
                                                         ' use new name in ABBREVIATED format
            Call ReadItem.AppendToTextList("Amey Jadal/EXTNEW/US/MAIL")
                                                         ' use new name in ABBREVIATED format
            Call ReadItem.AppendToTextList("Steve Marker/EXTNEW/US/MAIL") 
                                                          ' use new name in ABBREVIATED format
            Call ReadItem.AppendToTextList("Ye Ping Sue/EXTNEW/US/MAIL")
                                                         ' use new name in ABBREVIATED format
            Call ReadItem.AppendToTextList("Krish Hassle/EXTNEW/US/MAIL")
                                                          ' use new name in ABBREVIATED format                       
            ReadItem.IsReaders=True 'This method use to set Readers to newly added users as Reader                       
            Call doc.Save(True,False)     
        End If       
        Msgbox "document is not selected, please select at least one document"     
End If      
End Sub

Thanks for reading this article, hope you like it, if you have any difficulty please contact us on ‘’ or click here to contact us.

No comments :