The code below is supposed to update the Portal_Doc values that match the Import_Doc values. It check all the matching docs, based on MID_CCE_Commerce_ID field matching. This code works for 2 other forms, and sets of views. But with this form, it does not. This form has Formulas Inherit Field Values From Selected Documents set, which is different from the other forms that work. The problem is the Call Portal_Doc.Save(False,True) does not seem to save the updates. It never saves, unless I am missing something else. Any feedback is very welcome. Thanks
Sub Initialize
’ Dim newvalue As Variant
Set Session = New NotesSession
Set db = Session.CurrentDatabase
Set Import_View = db.GetView("CCE Data For Edit Imports")
Set Import_Doc = Import_View.GetFirstDocument
If Import_Doc Is Nothing Then
Msgbox ("CCE Data For Edit Imports view unavailable.")
End
End If
Set Customer_View = db.GetView("CCE Data - Cat")
Set Portal_Doc = Customer_View.GetFirstDocument
If Portal_Doc Is Nothing Then
Msgbox ("CCE Data - Cat view unavailable.")
End
End If
Do Until Portal_Doc Is Nothing
Customer_ID_Hold = Portal_Doc.MID_CCE_Commerce_ID(0)
Set Import_Doc = Import_View.GetDocumentByKey(Customer_ID_Hold)
ProcessThisID:
If Not Import_Doc Is Nothing Then
If Customer_ID_Hold = Import_Doc.MID_CCE_Commerce_ID(0) Then
' If Portal_ID_Hold = Import_Doc.MID_CCE_Commerce_ID(0) Then
' Print "Updating: "+ Portal_ID_Hold
If Import_Doc.CCE_Hosting_Geo(0) <> "" Then newvalue1= Import_Doc.CCE_Hosting_Geo(0)
If Import_Doc.CCE_Hosting_Geo(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( CCE_Hosting_Geo ,newvalue1)
If Import_Doc.CCE_Geo(0) <> "" Then newvalue2 = Import_Doc.CCE_Geo(0)
If Import_Doc.CCE_Geo(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( CCE_Geo ,newvalue2)
'[ If Import_Doc.CCE_Geo(0) <> "" Then Print "CCE Geo Set" +newvalue2
If Import_Doc.CCE_Country(0) <> "" Then newvalue3 = Import_Doc.CCE_Country(0)
If Import_Doc.CCE_Country(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( CCE_Country ,newvalue3)
'numeric
If Import_Doc.CCEStoreID(0) > 0 Then newvalue4 = Import_Doc.CCEStoreID(0)
If Import_Doc.CCEStoreID(0) > 0 Then Set notesitem = Portal_Doc.ReplaceItemValue( CCEStoreID ,newvalue4)
If Import_Doc.CommerceID(0) <> "" Then newvalue5 = Import_Doc.CommerceID(0)
If Import_Doc.CommerceID(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( CommerceID ,newvalue5)
If Import_Doc.LiveDate(0) <> "" Then newvalue6 = Import_Doc.LiveDate(0)
If Import_Doc.LiveDate(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( LiveDate ,newvalue6)
If Import_Doc.IGS(0) <> "" Then newvalue7 = Import_Doc.IGS(0)
If Import_Doc.IGS(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( IGS ,newvalue7)
If Import_Doc.SWG(0) <> "" Then newvalue8 = Import_Doc.SWG(0)
If Import_Doc.SWG(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( SWG ,newvalue8)
If Import_Doc.PWS(0) <> "" Then newvalue9 = Import_Doc.PWS(0)
If Import_Doc.PWS(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( PWS ,newvalue9)
If Import_Doc.pSeries(0) <> "" Then newvalue10 = Import_Doc.pSeries(0)
If Import_Doc.pSeries(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( pSeries ,newvalue10)
If Import_Doc.xSeries(0) <> "" Then newvalue11= Import_Doc.xSeries(0)
If Import_Doc.xSeries(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( xSeries ,newvalue11)
If Import_Doc.PCD(0) <> "" Then newvalue12 = Import_Doc.PCD(0)
If Import_Doc.PCD(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( PCD ,newvalue12)
If Import_Doc.Description(0) <> "" Then newvalue13 = Import_Doc.Description(0)
If Import_Doc.Description(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( Description ,newvalue13)
If Import_Doc.Description(0) <> "" Then Print "should update : "+ newvalue13
If Portal_Doc.Description(0) = "old" Then Messagebox "Check it out"
If Import_Doc.SiteBranding(0) <> "" Then newvalue14 = Import_Doc.SiteBranding(0)
If Import_Doc.SiteBranding(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( SiteBranding ,newvalue14)
' do not edit Mid_CCE_Commerce_ID(0)
' If Import_Doc.MID_CCE_Commerce_ID(0) > 0 Then newvalue15 = Import_Doc.MID_CCE_Commerce_ID(0)
' If Import_Doc.MID_CCE_Commerce_ID(0) > 0 Then Set notesitem = Portal_Doc.ReplaceItemValue(MID_CCE_Commerce_ID ,newvalue15)
' Do not edit MIDPortalID
' If Import_Doc.MIDPortalID(0) <> "" Then newvalue16 = Import_Doc.MIDPortalID(0)
' If Import_Doc.MIDPortalID(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( MIDPortalID ,newvalue16)
If Import_Doc.SiteName(0) <> "" Then newvalue17 = Import_Doc.SiteName(0)
If Import_Doc.SiteName(0) <> "" Then Set notesitem = Portal_Doc.ReplaceItemValue( SiteName ,newvalue17)
’ RICHTEXT FIELDS - NOT INCLUDED ***************
Call Portal_Doc.Save(False,True)
’ End If ’ Walks thru docs
Set Import_Doc = Import_View.GetNextDocument(Import_Doc)
If Not Import_doc Is Nothing Then ' Verifies that we found a matching Import document
If Customer_ID_Hold = Import_Doc.MID_CCE_Commerce_ID(0) Then
Goto ProcessThisID
End If
End If
End If
End If
' Print "Processing: "+Portal_Doc.MID_CCE_Commerce_ID(0)
Set Portal_Doc = Customer_View.GetNextDocument(Portal_Doc)
If Portal_Doc Is Nothing Then
Messagebox " Finished Import Edits "
End
End If
Loop ' Walks Customer view to get next Customer ID doc
End Sub