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

Not Found error on Event handler

Hello,

I am trying currently to create an event handler which checks two pairs of properties to have values in either of them. When all four properties are empty I get the first error which I put in the script, then if I fill in either of them I get the second error. Until now everything works, but when both pairs have at least one property filled in the Not Found error is raised and I cannot create the document.
Option Explicit

Dim PropertyValues : Set PropertyValues = Vault.ObjectPropertyOperations.GetProperties( ObjVer, true )

If PropertyValues.SearchForProperty(100).TypedValue.GetLookupID = 55 Then

Dim szLegalScope : szLegalScope = PropertyValues.SearchForProperty(1360).TypedValue.DisplayValue
Dim szOrg : szOrg = PropertyValues.SearchForProperty(1397).TypedValue.DisplayValue
Dim szFormalApprovers : szFormalApprovers = PropertyValues.SearchForProperty(1373).TypedValue.DisplayValue
Dim szFormalApproversEB : szFormalApproversEB = PropertyValues.SearchForProperty(1463).TypedValue.DisplayValue

If szOrg = "" And szLegalScope = "" Then
Err.Raise MFScriptCancel , "Please fill in either Employer Scope or Organizational Scope."
ElseIf szFormalApprovers = "" And szFormalApproversEB = "" Then
Err.Raise MFScriptCancel , "Please fill in either Formal Approvers or Formal Approvers EB."
End If
End If



The full error message is this one:

CoScriptObjectFactory.cpp, 271, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
ScriptErrorHelper.cpp, 96, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MDispatchExImpl.h, 679, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MDispatchExImpl.h, 826, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MetadataCardAction.cpp, 386, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MetadataCardAction.cpp, 570, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MetadataEditor.cpp, 2621, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MetadataModel.cpp, 4226, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MetadataModel.cpp, 4971, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
CoVaultMountingDocumentOperations.cpp, 190, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
CoVaultMountingDocumentOperations.cpp, 399, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
DocumentCache.cpp, 1252, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
DocumentCache.cpp, 4811, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
DocumentCache.cpp, 4920, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
DocumentCache.cpp, 5160, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
RPCMethodCallWithRetry.h, 36, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
RPCMethodCallWithRetry.h, 36, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
RPCDocumentOperations.cpp, 13007, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
RPCDocumentOperations.cpp, 8549, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
MCallInLoop.h, 620, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 3027, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
VaultDBSessionEvents.cpp, 314, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
VaultDBSessionEvents.cpp, 1552, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 269, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 328, Script execution failed. ((BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize: 7086-1)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 328, Not found. (0x8004000B)
VaultScriptSessionTemplates.cpp, 500, Not found. (0x8004000B)
CoActiveScriptSite.cpp, 903, Not found. (0x8004000B)
CoActiveScriptSite.cpp, 745, Not found. (0x8004000B)
BeforeCreateNewObjectFinalize::MFiles.ComplianceKit.MFEventHandlerBeforeCreateNewObjectFinalize, 22, Not found. (0x8004000B)
CoDynamicCLRObjectWrapper.cpp, 552, Not found. (0x8004000B)
CoDynamicCLRObjectWrapper.cpp, 322, Not found. (0x8004000B)
ManagedError.cpp, 129, Not found. (0x8004000B)
VaultApplicationBase.cs, 664 (IL:77), Not found. (0x8004000B)
MethodInfo.cs, 228 (IL:105), Not found. (0x8004000B)
VersionControlModule.cs, 383 (IL:53), Not found. (0x8004000B)
WorkingCopy.cs, 1418 (IL:25), Not found. (0x8004000B)
ControlledDocument.cs, 1138 (IL:288), Not found. (0x8004000B)
M-Files Compliance Kit 3.0.777.35: [MFilesAPI.ObjectVersionAndProperties CreateNewObjectEx(Int32, MFilesAPI.PropertyValues, MFilesAPI.SourceObjectFiles, Boolean, Boolean, MFilesAPI.AccessControlList)], IL:-1, Not found. (0x8004000B)
CoVaultObjectOperations.cpp, 2192, Not found. (0x8004000B)
ServerVaultObjectOperationsHelper.cpp, 1092, Not found. (0x8004000B)
ServerVaultObjectOperationsHelper.cpp, 1368, Not found. (0x8004000B)
ServerVaultObjectOperationsHelper.cpp, 1600, Not found. (0x8004000B)
RPCObjectOperationsHelper.cpp, 443, Not found. (0x8004000B)
CoRPCOverCOM.cpp, 5389, Not found. (0x8004000B)
RPCDocumentOperations.cpp, 5596, Not found. (0x8004000B)
MCallInLoop.h, 620, Not found. (0x8004000B)
RPCDocumentOperationsHelper.cpp, 2415, Not found. (0x8004000B)
RPCDocumentOperationsHelper.cpp, 2549, Not found. (0x8004000B)
VaultDBSessionEvents.cpp, 314, Not found. (0x8004000B)
VaultDBSessionEvents.cpp, 1552, Not found. (0x8004000B)
VaultScriptSessionTemplates.cpp, 269, Not found. (0x8004000B)
VaultScriptSessionTemplates.cpp, 334, Not found. (0x8004000B)
VaultScriptSessionTemplates.cpp, 500, Not found. (0x8004000B)
CoActiveScriptSite.cpp, 903, Not found. (0x8004000B)
CoActiveScriptSite.cpp, 745, Not found. (0x8004000B)
BeforeCreateNewObjectFinalize::EnsureFormalApprovers, 9, Not found. (0x8004000B)
CoPropertyValues.cpp, 348, Not found. (0x8004000B)
(M-Files 19.7.8028.5)


Do you think you can help me?
BR,
BlackRose
Parents
  • It is not mandatory, but the property needs to be there at the time if you want to use it in an event handler. Therefor the order of adding the property can be an issue. If your event handler becomes active before metadata card configuration has added the property then you will get an error.
    Anyway, you should always do your best to filter the objects in an event handler. Basically it fires every time you save or change any object (when depends on the type of event handler). But in most cases you only want the event handler to do something on a specific object type in a specific class when specific properties have specific values. So start out with a few lines of code to stop the process immediately if the object is not the desired object type, class a.s.o. With that in place you probably also need to put in some code to handle the situation if the needed properties are not available or empty or have an unacceptable value. Sooner or later you will run into unexpected behavior and it will create errors. So use your imagination to foresee all possible combinations of properties and make sure your code can handle them somehow.
Reply
  • It is not mandatory, but the property needs to be there at the time if you want to use it in an event handler. Therefor the order of adding the property can be an issue. If your event handler becomes active before metadata card configuration has added the property then you will get an error.
    Anyway, you should always do your best to filter the objects in an event handler. Basically it fires every time you save or change any object (when depends on the type of event handler). But in most cases you only want the event handler to do something on a specific object type in a specific class when specific properties have specific values. So start out with a few lines of code to stop the process immediately if the object is not the desired object type, class a.s.o. With that in place you probably also need to put in some code to handle the situation if the needed properties are not available or empty or have an unacceptable value. Sooner or later you will run into unexpected behavior and it will create errors. So use your imagination to foresee all possible combinations of properties and make sure your code can handle them somehow.
Children
No Data