I'm trying to append names in a field but I get illegal use of property and can't figure out why. What I'm trying to do is I have 4 fields with different names in them, I want them all in a Text list field so I can display the same doc in a view multple times. The code I'm having problems with is near the bottom of the function.
Function CreateNewResourceDoc( docRequest As NotesDocument, docResource As NotesDocument, newRequest As String ) As NotesDocument
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim docAdd As NotesDocument
Dim keyword As String
Dim msg As String
Dim answer As Integer
Dim cnEmp As String
'INITIALIZATION
Set db = s.CurrentDatabase
Set CreateNewResourceDoc = Nothing
answer = IDYES
strVIOwer = "vwAdminITOwner"
Set ITView = DB.GetView( "vwAdminITOwner")
'LOOK FOR DUPLICATE RESOURCE ALREADY ADDED (NOT ON NEW HIRE REQUEST)
If ( ( docRequest.RequestType(0) = "Change" Or docRequest.RequestType(0) = "Transfer" ) And newRequest = "Y" ) Or newRequest <> "Y" Then
cnEmp = GetEmployeeName( docRequest, "Common" )
keyword = cnEmp & SEP & docResource.ResourceType(0) & SEP & docResource.Resource(0)
Set docAdd = GetAddedResourceDocByKey( keyword )
If Not docAdd Is Nothing Then
msg = docResource.ResourceType(0) & " - " & docResource.Resource(0) & " is already a current resource for " & cnEmp & ". Select YES to create a duplicate resource or select NO to cancel creating this resource."
answer = Messagebox ( msg, MB_YESNO + MB_ICONQUESTION, "Warning: Duplicate Resource" )
End If
End If
'CREATE NEW RESOURCE DOCUMENT
If answer = IDYES Then
Set doc = db.CreateDocument
'SET RESOURCE DOCUMENT FIELDS
doc.UNID = doc.UniversalID
doc.Form = "frmResource"
doc.FormTitle = "System"
doc.NewRequest = newRequest
Call UpdateResourceDocWithRequestInfo( doc, docRequest, "Add" )
doc.SysPrimarySystem = docResource.AdminSystemPrimary(0)
doc.SysSystemDescription = docResource.AdminSystemDescription(0)
doc.SysSystemID = docResource.AdminSystemID(0)
groupName = docResource.AdminSystemOwner(0)
ctr = 1
' ============= Add Members of Group ==============
Set ITOwnerDoc= ITView.GetDocumentByKey(Trim(groupName) , True )
If Not ITOwnerDoc Is Nothing Then
Set VMembers = ITOwnerDoc.GetFirstItem( "AdminITOwnerMembers" )
Forall v In VMembers.Values
Call Doc.ReplaceItemValue( "AddSystemTaskAssignee"&ctr, v )
ctr = ctr + 1
End Forall
End If
'==================================================================
Call Doc.FieldAppendText("ITOwnersAll", "," &doc.AddSystemTaskAssignee1)
Call Doc.FieldAppendText("ITOwnersAll", "," &doc.AddSystemTaskAssignee2)
'SAVE THE NEW RESOURCE DOCUMENT
Call doc.ComputeWithForm(False,False)
Call doc.Save( True, False, True )
Set CreateNewResourceDoc = doc
End If
End Function
Function CreateNewResourceDoc( docRequest As NotesDocument, docResource As NotesDocument, newRequest As String ) As NotesDocument
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim docAdd As NotesDocument
Dim keyword As String
Dim msg As String
Dim answer As Integer
Dim cnEmp As String
'INITIALIZATION
Set db = s.CurrentDatabase
Set CreateNewResourceDoc = Nothing
answer = IDYES
strVIOwer = "vwAdminITOwner"
Set ITView = DB.GetView( "vwAdminITOwner")
'LOOK FOR DUPLICATE RESOURCE ALREADY ADDED (NOT ON NEW HIRE REQUEST)
If ( ( docRequest.RequestType(0) = "Change" Or docRequest.RequestType(0) = "Transfer" ) And newRequest = "Y" ) Or newRequest <> "Y" Then
cnEmp = GetEmployeeName( docRequest, "Common" )
keyword = cnEmp & SEP & docResource.ResourceType(0) & SEP & docResource.Resource(0)
Set docAdd = GetAddedResourceDocByKey( keyword )
If Not docAdd Is Nothing Then
msg = docResource.ResourceType(0) & " - " & docResource.Resource(0) & " is already a current resource for " & cnEmp & ". Select YES to create a duplicate resource or select NO to cancel creating this resource."
answer = Messagebox ( msg, MB_YESNO + MB_ICONQUESTION, "Warning: Duplicate Resource" )
End If
End If
'CREATE NEW RESOURCE DOCUMENT
If answer = IDYES Then
Set doc = db.CreateDocument
'SET RESOURCE DOCUMENT FIELDS
doc.UNID = doc.UniversalID
doc.Form = "frmResource"
doc.FormTitle = "System"
doc.NewRequest = newRequest
Call UpdateResourceDocWithRequestInfo( doc, docRequest, "Add" )
doc.SysPrimarySystem = docResource.AdminSystemPrimary(0)
doc.SysSystemDescription = docResource.AdminSystemDescription(0)
doc.SysSystemID = docResource.AdminSystemID(0)
groupName = docResource.AdminSystemOwner(0)
ctr = 1
' ============= Add Members of Group ==============
Set ITOwnerDoc= ITView.GetDocumentByKey(Trim(groupName) , True )
If Not ITOwnerDoc Is Nothing Then
Set VMembers = ITOwnerDoc.GetFirstItem( "AdminITOwnerMembers" )
Forall v In VMembers.Values
Call Doc.ReplaceItemValue( "AddSystemTaskAssignee"&ctr, v )
ctr = ctr + 1
End Forall
End If
'==================================================================
Call Doc.FieldAppendText("ITOwnersAll", "," &doc.AddSystemTaskAssignee1)
Call Doc.FieldAppendText("ITOwnersAll", "," &doc.AddSystemTaskAssignee2)
'SAVE THE NEW RESOURCE DOCUMENT
Call doc.ComputeWithForm(False,False)
Call doc.Save( True, False, True )
Set CreateNewResourceDoc = doc
End If
End Function