AliciaVee
asked on
Add value in an authors field with button click
I have a button that updates the value of an author's field to a role. this works fine as shown in code #1. I now want to add the creator of the document, back as the author at the end of a review cycle. The field that holds the creator's name, which is a "names" field is where I'm trying to take the value. What I came up with in code #2, doesn't work and places a null string in the DocAuthor field. Can someone help?
Code #1 -- updates the DocAuthor field when using a role:
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim AuthorRole As String
AuthorRole = "[Recommend]"
Set uidoc = w.CurrentDocument
Set doc = uidoc.Document
Call ChangeStatus("Verified","ApprovedBy", "ApprovedDate")
Call SendNotice ("NotifyMsg1", doc)
Set item = doc.ReplaceItemValue("DocAuthor", AuthorRole)
doc.Save True, True
uidoc.Save
uidoc.Close
Code #2 -- does not update the original author's name into the DocAuthor field:
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim AuthorRole As String
AuthorRole = RequestBy
Set uidoc = w.CurrentDocument
Set doc = uidoc.Document
Call ChangeStatus ("Move to Inventory", "", "")
Call SendNotice ("NotifyMsg3", doc)
Set item = doc.ReplaceItemValue("DocAuthor", AuthorRole)
doc.Save True, True
uidoc.Save
uidoc.Close
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked perfectly! Thanks very much!
I hope in the RequestBy ComputedWhenComposed field, you are using
@Name([CN]; @UserName)
If you want to update the the last edited author name, change the RequestBY field to Computed.
Else, simply, you can create a Authors field and use the code as specified.