How to set new Author name in existing Author field using Lotus Script?
You
can set author name in existing document. For this you should have at-least manager/ designer
/
editor /Author*
Author*:
You can add another author name only if you have already added as Author in existing
document Author field
From
the below script check for function
AuthItem.IsAuthors=True,
This
is important step , only replace field values in for existing author filed will
not work , you have to explicitly set ‘IsAuhtor’ property as true
Now,
look at the steps how to add Another Author 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 author field
Sub Initialize
'copyright xpagedomino.com
Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim view As NotesView
Dim uiview As NotesUIView
Dim doccoll As NotesDocumentCollection
Dim AuthItem As NotesItem
Set uiview=ws.CurrentView
Set doccoll=uiview.Documents
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 AuthItem=doc.GetFirstItem("NewAuthors")
' New author field , you can use existing author field
if you have author field already created on form
If Not AuthItem Is Nothing Then
Call AuthItem.AppendToTextList("Amol
Jalak/EXTNEW/US/MAIL")
' use new
name in ABBREVIATED format
Call AuthItem.AppendToTextList("Amey
Jadal/EXTNEW/US/MAIL")
' use new
name in ABBREVIATED format
Call AuthItem.AppendToTextList("Steve
Marker/EXTNEW/US/MAIL")
' use new
name in ABBREVIATED format
Call AuthItem.AppendToTextList("Ye Ping
Sue/EXTNEW/US/MAIL")
' use new
name in ABBREVIATED format
Call AuthItem.AppendToTextList("Krish
Hassle/EXTNEW/US/MAIL")
' use new
name in ABBREVIATED format
AuthItem.IsAuthors=True
' This method use to set Authors to newly added
users as Author
Call doc.Save(True,False)
End If
Else
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 ‘admin@xpagedomino.com’ or click here to contact us.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a comment