Hey, I'm triyng to access a property that is in chose from list Object. Im getting "Object required: '1' ". as an error. Thank you in advance for your help.
Hey, I'm triyng to access a property that is in chose from list Object. Im getting "Object required: '1' ". as an error. Thank you in advance for your help.
Option Explicit Dim postavke postavke = PropertyValues.SearchForProperty(1283).TypedValue.GetValueAsLookup.Item Dim uvjet : uvjet = Vault.ObjectPropertyOperations.GetProperties( postavke.ToObjVer(), True ) If uvjet.SearchForProperty(1282).TypedValue.DisplayValue = "Yes" Then AllowStateTransition = True Else AllowStateTransition = False End If
Try this:
Option Explicit Dim postavke set postavke = PropertyValues.SearchForProperty(1283).TypedValue.GetValueAsLookup().GetAsObjVer Dim uvjet : set uvjet = Vault.ObjectPropertyOperations.GetProperties( postavke, True ) If uvjet.SearchForProperty(1282).TypedValue.DisplayValue = "Yes" Then AllowStateTransition = True Else AllowStateTransition = False End If
When you get an error you need to look carefully in the full error description. You will be able to find which line in your code creates the error. That is quite helpful in debugging - especially if you combine it with careful use of the API documentation https://developer.m-files.com/APIs/COM-API/Reference/
DocumentCache.cpp, 7599, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
DocumentCache.cpp, 19402, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCMethodCallWithRetry.h, 27, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCMethodCallWithRetry.h, 27, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperations.cpp, 11362, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperations.cpp, 5540, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
MCallInLoop.h, 521, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 1995, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelperPrivate.cpp, 212, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 9630, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 10831, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 11087, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 25849, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 25979, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 9647, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 11087, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
RPCDocumentOperationsHelper.cpp, 25791, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
StateTransitionManager.cpp, 263, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
StateTransitionManager.cpp, 1050, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 275, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 340, Script execution failed. ((State transition (ID: 153), StateTransitionValidation: 36-2)) (0x800408BB)
VaultScriptSessionTemplates.cpp, 340, Not found. (ID: 1) (0x8004000B)
VaultScriptSessionTemplates.cpp, 523, Not found. (ID: 1) (0x8004000B)
CoActiveScriptSite.cpp, 897, Not found. (ID: 1) (0x8004000B)
CoActiveScriptSite.cpp, 739, Not found. (ID: 1) (0x8004000B)
State transition (ID: 153), StateTransitionValidation, 6, Not found. (ID: 1) (0x8004000B)
MNullPropagatingDispatchImpl.h, 127, Not found. (ID: 1) (0x8004000B)
MNullPropagatingDispatchImpl.h, 174, Not found. (ID: 1) (0x8004000B)
CoVaultObjectPropertyOperations.cpp, 345, Not found. (ID: 1) (0x8004000B)
ServerVaultObjectPropertyOperationsHelper.cpp, 77, Not found. (ID: 1) (0x8004000B)
RPCObjectOperationsHelper.cpp, 34, Not found. (ID: 1) (0x8004000B)
CoRPCOverCOM.cpp, 6935, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperations.cpp, 6382, Not found. (ID: 1) (0x8004000B)
MCallInLoop.h, 521, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperationsHelper.cpp, 5800, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperationsHelper.cpp, 5838, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperationsHelper.cpp, 14356, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperationsHelper.cpp, 14584, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperationsHelperPrivate.cpp, 12559, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperationsHelper.cpp, 28811, Not found. (ID: 1) (0x8004000B)
RPCDocumentOperationsHelperPrivate.cpp, 11476, Not found. (ID: 1) (0x8004000B)
(M-Files 23.9.12966.6 2023-11-02T06:36:26.710Z)
Note this line:
State transition (ID: 153), StateTransitionValidation, 6, Not found. (ID: 1) (0x8004000B)
The error origins from line 6 in the code.
"Not found" probably means that the variable "postavke" did not provide the required input. So, you need to go back to line 4 and figure out what is wrong there.
It could be that a simple "()" is needed after GetAsObjver as suggest in the documentation.
It could also be that property 1283 is not a single select lookup property, or that the property is empty on the current object. I can't tell from the info available here, that is something you need to work on.
Option Explicit Dim postavke set postavke = PropertyValues.SearchForProperty(1283).TypedValue.GetValueAsLookup().GetAsObjVer() Dim uvjet : set uvjet = Vault.ObjectPropertyOperations.GetProperties( postavke, True ) If uvjet.SearchForProperty(1282).TypedValue.DisplayValue = "Yes" Then AllowStateTransition = True Else AllowStateTransition = False End If
To me it all checks out. Only the code could be the issue. I belive the objVer "Postavke" is taken I beleve so because it is searching for ID 1 but when i use it to search property it points to no object type or wrong one so it gets "not forund".
I have tested it by using
Dim OV : set OV = Vault.ObjectOperations.GetLatestObjVer( postavke.objID, false, false )
So problem is with ObjVer that i get from Postavke its missing something.
working code looks like
Option Explicit Dim postavke set postavke = PropertyValues.SearchForProperty(1283).TypedValue.GetValueAsLookup().GetAsObjVer() Dim OV : set OV = Vault.ObjectOperations.GetLatestObjVer( postavke.objID, false, false ) Dim uvjet : set uvjet = Vault.ObjectPropertyOperations.GetProperties( OV, True ) If uvjet.SearchForProperty(1282).TypedValue.DisplayValue = "Yes" Then AllowStateTransition = True Else AllowStateTransition = False End If
I belive this is a bug. Where do i report something like that?
I do not agree that this is a bug.
The problem is perhaps that you set True as the last variable in line 6
Dim uvjet : set uvjet = Vault.ObjectPropertyOperations.GetProperties( postavke, True )
This forces the code to check the properties from the server. If the object has not been checked in at this point there will be no properties to find on the server. Try setting it to False in stead.
Dealing with a similar task, I found this thread.
I think it is a bug.
GetAsObjVer() returns for the version field "-1",
while
GetLatestObjVer returns for the version field "1" (or another positive integers).
The "-1" value called from outside (e.g. EXCEL) causes no error.
The VBScript code plugged into M-Files gives the "No found." error.
I hope, somebody reads this after 11 months and, maybe, it is helpful for somebody struggling at a similar issue.
I could not find any related documentation. Best regards. Holger
-1 is a default value for "latest version"
This is not a bug but an important build in function that allows the system to always get the latest version of an object no matter whether that is version 1 or version 101.
When dealing with versions i scripts or VAF it is often necessary to specifiy a specific version. This can be tricky when you check out an object to manipulate it because the version increases by 1 in the moment you check it out. So you fetched version 1 from the server, but you are manipulating version 2.
I did not argue about the feature of "-1". The original post described an error message "Not Found.", when referring to an object version retrieved by GetAsObjVer.
The methods of ObjectPropertyOperations should deal with the "-1" correctly, shouldn't they?
It is not my place to argue on behalf of M-Files. However, I think the methods work as they should. Depending on your intentions you sometimes just need to read values from an object without checking it out. In that case you get the correct version. Other times you need to manipulate data somehow and you check out the object and get a new version with an increased version number. Depending on your choice you need to handle the version number accordingly.
© 2024 M-Files, All Rights Reserved.