Hi,
I’m trying to make a script for allowing state transition if property auditors(1237) have changed. I ‘m stuck with this since it seems like the script doesn't get the value for property 1237 from the previous version.
I know that the value hasn’t changed between the versions so I added lines 21 & 31 shell.logevent 4 and it looks in the event log that there is just empty value whereas there should be the same value as in current version (I have at least triple checked that this hasn’t changed between the versions). It feels like the script is correctly accessing the previous version but is having trouble retrieving the property value.
Any ideas how to change the script? Is there maybe something wrong with the GetProperty on line 20?
This is what I get to event log from line 9:
This is what I get to event log from lines 21 & 31
This is the accessed previous version (line 27):
And this is how the property looks like in that version in UI:
This is my script:
Option Explicit 'For Event viewer events. Dim shell : Set shell = CreateObject("WScript.Shell") ' Get the current auditor(s). Dim szAuditors szAuditors = PropertyValues.SearchForProperty(1237).TypedValue.DisplayValue shell.LogEvent 4, "Current Auditors: " & szAuditors ' Get the previous version Auditors value Dim sObjVersions Set sObjVersions = Vault.ObjectOperations.GetHistory(ObjVer.ObjID) Dim szAuditorsOfPreviousVersion If sObjVersions.Count > 1 Then Dim prevObjVer Set prevObjVer = sObjVersions.Item(sObjVersions.Count - 2).ObjVer On Error Resume Next szAuditorsOfPreviousVersion = Vault.ObjectPropertyOperations.GetProperty(prevObjVer, 1237).TypedValue.DisplayValue shell.LogEvent 4, "Previous Auditors: " & szAuditorsOfPreviousVersion If Err.Number <> 0 Then shell.LogEvent 1, "Error retrieving property from previous version: " & Err.Description Err.Clear End If On Error GoTo 0 shell.LogEvent 4, "Previous Version Number: " & (sObjVersions.Count - 2) Else szAuditorsOfPreviousVersion = "" End If shell.LogEvent 4, "Previous Auditors: " & szAuditorsOfPreviousVersion ' Logic test if the fields are not the same then move to next in workflow. If szAuditors <> szAuditorsOfPreviousVersion Then AllowStateTransition = True End If