I am trying to activate the History flag of a project in the customize section of QC11 with VBS. This is my script:
If Not voCustomization.IsLocked Then
' lock
voCustomization.LockObject
Print "[" & Sysdate() & "] Locked customization object."
If Err.Number = 0 Then
Set custFields = voCustomization.Fields
' Make field searchable
Set fcraField = custFields.Field("Test", "TS_USER_88")
If fcraField.IsSupportsHistory Then
If fcraField.IsHistory Then
Print "[" & Sysdate() & "] History already set on TS_USER_88 of " & vsDomain & "." & vsProject
Else
fcraField.IsHistory = True
Print "[" & Sysdate() & "] History enabled on TS_USER_88 of " & vsDomain & "." & vsProject
End If
End If
' check if the customization object has changed and commit if neccessary
If voCustomization.IsChanged Then
Print "[" & Sysdate() & "] Uncommited changes are waiting."
voCustomization.Commit
Print "[" & Sysdate() & "] Successfully commited change"
Else
Print "[" & Sysdate() & "] No uncommited changes are pending."
End If
Else
Print "[" & Sysdate() & "] Could not lock project " & vsDomain & "." & vsProject & ", abording now..."
End If 'voTDC.Customization.LockObject
' unlock
voCustomization.UnLockObject
Print "[" & Sysdate() & "] Unlocked customization object."
When I check the output of the script I can see that it successfully connected to the project and says "History already set on ...". When I go into the customization section > Project Entities > Test > User Fields > TS_USER_88
then the "History" checkbox is not checked. What am I doing wrong?
If custFields.FieldExists("TEST", "TS_USER_88") Then
Set field = custFields.Field("TEST", "TS_USER_88")
If field.IsSupportsHistory Then
If field.IsHistory Then
Print "[" & Sysdate() & "] History Flag already enabled on TS_USER_88, performing no changes."
Else
field.IsHistory = True
Print "[" & Sysdate() & "] Successfully enabled history field of TS_USER_88."
'Commit changes to database
cust.Commit()
Print "[" & Sysdate() & "] Changes committed to DB"
End If
Else
Print "[" & Sysdate() & "] FAILED to enable hisotry field of TS_USER_88."
End If
Else
Print "[" & Sysdate() & "] Project can NOT be migrated..."
Print "[" & Sysdate() & "] FIELD TS_USER_88 NOT FOUND - PROJECT IS NOT SUPPORTED."
End If