Greetings,
We have issues with a VB Script that sends a document to another state.
We have a specific situation with our client. When the document meets some condition from VB Script, it is necessary to transfer it to another state.
In our case, it does not want to transfer the document if it is not a System Administrator account or there is no direct connection from the state from which it sends the document to the state where the document should be placed via VB Script.
The above logic is mandatory for us at the client and that part would have to work because of the Audit Trail.
You can replicate the error by creating three states in workflow - "Test1", "Test2", "Test3". Place in Test 2 the script that will switch to "Test3" and try to switch with a non-admin user. (There must not be a state transition in the workflow between Test2 and Test3).
The script im using at client:
Option Explicit
Dim Employee, iClass, DepartmentManager, iWFState, FunctionManager
iClass = PropertyValues.SearchForProperty(100).TypedValue.DisplayValue
Employee = PropertyValues.SearchForProperty(1061).TypedValue.DisplayValue
DepartmentManager = PropertyValues.SearchForProperty(1161).TypedValue.DisplayValue
FunctionManager = PropertyValues.SearchForProperty(1160).TypedValue.DisplayValue
' Create a typed value for the "last modified by" value.
Dim objLastModifiedByTypedValue
Set objLastModifiedByTypedValue = CreateObject("MFilesAPI.TypedValue")
objLastModifiedByTypedValue.SetValue MFDatatypeLookup, CurrentUserID
' Update the last modification info.
Vault.ObjectPropertyOperations.SetLastModificationInfoAdmin ObjVer, True, objLastModifiedByTypedValue, False, Nothing
'Conditions depending on property Class and FunctionManager = Employee
IF iClass = "Work Instruction" AND Employee = DepartmentManager Then
' PropertyValues.SearchForProperty(1061).Value.SetValue MFDataTypeMultiSelectLookup, null
'Save the changed propertyvalues to the object
iWFState = Vault.WorkflowOperations.GetWorkflowStateIDbyAlias("WFS.BoardDecision2.41Approved")
PropertyValues.SearchForProperty(39).TypedValue.SetValue MFDataTypeLookup, iWFState
Vault.ObjectPropertyOperations.SetAllProperties ObjVer, true, PropertyValues
ELSEIF iClass = "Procedure" AND Employee = FunctionManager Then
' PropertyValues.SearchForProperty(1061).Value.SetValue MFDataTypeMultiSelectLookup, null
'Save the changed propertyvalues to the object
iWFState = Vault.WorkflowOperations.GetWorkflowStateIDbyAlias("WFS.BoardDecision2.41Approved")
PropertyValues.SearchForProperty(39).TypedValue.SetValue MFDataTypeLookup, iWFState
Vault.ObjectPropertyOperations.SetAllProperties ObjVer, true, PropertyValues
ELSEIF iClass = "Decision" AND Employee = FunctionManager Then
IF PropertyValues.SearchForProperty(1156).TypedValue.DisplayValue = "No" Then
' PropertyValues.SearchForProperty(1061).Value.SetValue MFDataTypeMultiSelectLookup, null
'Save the changed propertyvalues to the object
iWFState = Vault.WorkflowOperations.GetWorkflowStateIDbyAlias("WFS.BoardDecision2.41Approved")
PropertyValues.SearchForProperty(39).TypedValue.SetValue MFDataTypeLookup, iWFState
Vault.ObjectPropertyOperations.SetAllProperties ObjVer, true, PropertyValues
END IF
END IF
In this case its not working for regular users:

In this case its working for regular users:

If state transition inbetween states 2 and 3 has deny permission, then its not working for System Admins.
I just want to point out that both ways work if user has System Admin role.
It was tested on versions from 22.2 to 22.5 and every time same problem occured.
