I've wrote a script in event handler beforecheckout in order to check-out objects linked with my main object when i check-out this main object.
Said otherwise:
There is a property multiselectlookup inside Object A with 2 objects linked : Object 1 and Object 2
I want to automatically check-out Object 1 and Object 2 when I check-out Object A
Here is my code:
Option Explicit
Dim Typeobjet
Dim Classeobjet
Classeobjet = Vault.ObjectPropertyOperations.GetProperty(ObjVer, 100).TypedValue.getlookupid 'PropertyValues.SearchForProperty(100).TypedValue.GetLookupID
Typeobjet = ObjVer.Type
if Typeobjet = 0 and Classeobjet = 27 then
Dim oObjID, oObjVer, oLookups, oLookup , oObjIDs
Dim oObjIDfils, IDfils, Verfils, oObjVerfils
Set oObjIDs = createobject("MFilesAPI.ObjIDs")
Set oLookups = Vault.ObjectPropertyOperations.GetProperty(ObjVer, 1287).TypedValue.GetValueAsLookups()
For Each oLookup In oLookups
IDfils = oLookup.Item
Verfils = oLookup.Version
Set oObjIDfils = Vault.ValueListItemOperations.GetValueListItemByID(0, IDfils).ObjID
Set oObjVerfils = Vault.ObjectOperations.GetLatestObjVer(oObjIDfils, True, True)
If Vault.ObjectOperations.IsObjectCheckedOutToThisUserOnThisComputer(oObjIDfils, True) = True Then
'Nothing
Else
oObjIDs.add -1, oObjIDfils
End If
Next
Call Vault.ObjectOperations.CheckOutMultipleObjects(oObjIDs)
end if
I've got an error saying to me that check-in and check-out operations must be paired in scripts....
Is anyone could help me.
Thanks in advance