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

Error trying to edit object during BeforeSetObjectPermission event handling

Hello.

I have a following task: "if there were added a specific usergroups to permissions of object then to clear a field of this object."

I created an eventhandler for event BeforeSetObjectPermissions, it is successfully triggering on adding of usergroups, but I am unable to clear the fields of object. Looks like it is not allowed to make changes in objects during BeforeSetObjectPermissions event handling. I am receiving the error "Operation not allowed. Script is being executed for the object "48". (0x80040834)" at the row with CheckOut or SetProperty function.

Is there any way to solve this problem?

Thank you!

Parents
  • So I haven't tried this myself before, but you should not need to check out the current object during an event handler; it should already be checked out.

    I'm not saying that this will definitely work, but the concept of checking the object out should not be needed.

    Do you get the same error thrown with just the SaveProperty call?  Can you show me the code you're trying and the full error stack?

  • Hi, Craig!

    I tried to make SetProperties alone as so as together to CheckIn and CheckOut and received the same error.

    Here is my reduced code (I made it for testing and it is also shows me an error "Operation not allowed. Script is being executed for the object")

    If ObjVer.Type = 0 then 
    
        Dim newPropertyValues: Set newPropertyValues = CreateObject("MFilesAPI.PropertyValues")
        Dim newPropertyValue: Set newPropertyValue = CreateObject("MFilesAPI.PropertyValue")
    
        newPropertyValue.PropertyDef = 1044
        newPropertyValue.TypedValue.SetValue MFDatatypeMultiLineText, "121212"
        newPropertyValues.Add -1, newPropertyValue
    
        Vault.ObjectPropertyOperations.SetProperties ObjVer, newPropertyValues '<< The error occurs on this row
        
    End if

     The error description is :

    CoScriptObjectFactory.cpp, 465, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    ScriptErrorHelper.cpp, 96, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MDispatchExImpl.h, 694, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MDispatchExImpl.h, 994, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataCardAction.cpp, 386, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataCardAction.cpp, 570, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataEditor.cpp, 2967, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataModel.cpp, 4266, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataModel.cpp, 4763, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    CoVaultMountingDocumentOperations.cpp, 3600, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    DocumentCache.cpp, 5954, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    DocumentCache.cpp, 6019, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    DocumentCache.cpp, 19901, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCMethodCallWithRetry.h, 28, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCMethodCallWithRetry.h, 28, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperations.cpp, 13190, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperations.cpp, 8120, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MCallInLoop.h, 712, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelper.cpp, 1417, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelper.cpp, 1602, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelperPrivate.cpp, 13413, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelper.cpp, 25842, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultDBSessionEvents.cpp, 428, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultDBSessionEvents.cpp, 1602, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultScriptSessionTemplates.cpp, 269, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultScriptSessionTemplates.cpp, 328, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultScriptSessionTemplates.cpp, 328, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultScriptSessionTemplates.cpp, 501, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoActiveScriptSite.cpp, 893, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoActiveScriptSite.cpp, 735, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    AfterSetObjectPermissions::pep22, 49, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoVaultObjectPropertyOperations.cpp, 381, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoVaultObjectPropertyOperations.cpp, 406, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoVaultObjectPropertyOperations.cpp, 475, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    ServerVaultObjectPropertyOperationsHelper.cpp, 415, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCObjectOperationsHelper.cpp, 109, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoRPCOverCOM.cpp, 6153, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperations.cpp, 7384, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    MCallInLoop.h, 712, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 3930, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 3460, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelperPrivate.cpp, 10809, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 10495, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 11898, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultTrTrackerHelper.cpp, 425, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultTrTrackerHelper.cpp, 1118, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultTrTrackerHelper.cpp, 1323, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    (M-Files 21.4.10123.9)

Reply
  • Hi, Craig!

    I tried to make SetProperties alone as so as together to CheckIn and CheckOut and received the same error.

    Here is my reduced code (I made it for testing and it is also shows me an error "Operation not allowed. Script is being executed for the object")

    If ObjVer.Type = 0 then 
    
        Dim newPropertyValues: Set newPropertyValues = CreateObject("MFilesAPI.PropertyValues")
        Dim newPropertyValue: Set newPropertyValue = CreateObject("MFilesAPI.PropertyValue")
    
        newPropertyValue.PropertyDef = 1044
        newPropertyValue.TypedValue.SetValue MFDatatypeMultiLineText, "121212"
        newPropertyValues.Add -1, newPropertyValue
    
        Vault.ObjectPropertyOperations.SetProperties ObjVer, newPropertyValues '<< The error occurs on this row
        
    End if

     The error description is :

    CoScriptObjectFactory.cpp, 465, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    ScriptErrorHelper.cpp, 96, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MDispatchExImpl.h, 694, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MDispatchExImpl.h, 994, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataCardAction.cpp, 386, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataCardAction.cpp, 570, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataEditor.cpp, 2967, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataModel.cpp, 4266, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MetadataModel.cpp, 4763, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    CoVaultMountingDocumentOperations.cpp, 3600, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    DocumentCache.cpp, 5954, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    DocumentCache.cpp, 6019, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    DocumentCache.cpp, 19901, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCMethodCallWithRetry.h, 28, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCMethodCallWithRetry.h, 28, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperations.cpp, 13190, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperations.cpp, 8120, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    MCallInLoop.h, 712, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelper.cpp, 1417, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelper.cpp, 1602, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelperPrivate.cpp, 13413, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    RPCDocumentOperationsHelper.cpp, 25842, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultDBSessionEvents.cpp, 428, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultDBSessionEvents.cpp, 1602, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultScriptSessionTemplates.cpp, 269, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultScriptSessionTemplates.cpp, 328, Script execution failed. ((AfterSetObjectPermissions::pep22: 48-47)) (0x800408BB)
    VaultScriptSessionTemplates.cpp, 328, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultScriptSessionTemplates.cpp, 501, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoActiveScriptSite.cpp, 893, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoActiveScriptSite.cpp, 735, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    AfterSetObjectPermissions::pep22, 49, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoVaultObjectPropertyOperations.cpp, 381, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoVaultObjectPropertyOperations.cpp, 406, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoVaultObjectPropertyOperations.cpp, 475, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    ServerVaultObjectPropertyOperationsHelper.cpp, 415, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCObjectOperationsHelper.cpp, 109, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    CoRPCOverCOM.cpp, 6153, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperations.cpp, 7384, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    MCallInLoop.h, 712, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 3930, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 3460, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelperPrivate.cpp, 10809, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 10495, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    RPCDocumentOperationsHelper.cpp, 11898, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultTrTrackerHelper.cpp, 425, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultTrTrackerHelper.cpp, 1118, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    VaultTrTrackerHelper.cpp, 1323, Operation not allowed. Script is being executed for the object "48". (0x80040834)
    (M-Files 21.4.10123.9)

Children
No Data