This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

BeforeCreateNewObjectFinalize and External Objects

We have an event handler script that explicitly excludes an externally maintained Project object:

' Get the user name
Dim userAccount
Set userAccount = Vault.UserOperations.GetUserAccount(CurrentUserID)
Dim vloginName
vloginName = userAccount.LoginName

'Get instance of Property values
Dim oPropVals: Set oPropVals = CreateObject("MFilesApi.PropertyValues")
Set oPropVals = Vault.ObjectPropertyOperations.GetProperties(ObjVer)

currentTitle = oPropVals.SearchForProperty(MFBuiltInPropertyDefNameOrTitle).TypedValue.Value

currentClass = oPropVals.SearchForProperty(MFBuiltInPropertyDefClass).TypedValue.DisplayValue


If ( currentClass <> "Project") Then
If ( ( (InStr(1, currentTitle, "!") > 0) _
or (InStr(1, currentTitle, "~") > 0) _
or (InStr(1, currentTitle, "@") > 0) _
or (InStr(1, currentTitle, "#") > 0) _
or (InStr(1, currentTitle, "%") > 0) _
or (InStr(1, currentTitle, "^") > 0) _
or (InStr(1, currentTitle, "&") > 0) _
or (InStr(1, currentTitle, "*") > 0) _
or (InStr(1, currentTitle, "?") > 0) ) _
and (InStr(1, vloginName, "mf_service") = 0) ) _
Then
Err.Raise MFScriptCancel, "Please remove the special characters in " + currentTitle
End If
End If

Yet, full refreshes of the Project object fail to complete.  Watching the refreshing status, I can see that objects are not updated or inserted.

Parents
  • When I deactivate the event handler, the refreshes work.

  • If your event handler changes a property that is used in synchronization with the external source, then you need to make sure the synchronization includes correct Update and Insert statements including the properties being changed and, of course, that the external database offers permission to change those properties to the user account used for the synchronization.

    Have you checked the event log to see which errors are generated?

Reply
  • If your event handler changes a property that is used in synchronization with the external source, then you need to make sure the synchronization includes correct Update and Insert statements including the properties being changed and, of course, that the external database offers permission to change those properties to the user account used for the synchronization.

    Have you checked the event log to see which errors are generated?

Children
  • Thanks for your advice.  My script explicitly excludes the Project class from this validation of Name or Title.  Maybe our use of Project as a property of most of these Documents affects the Project refreshes.  I don't know. 

    The event log did not show anything about the refresh.