it feels like I’ve met a solution to this problem somewhere in discussions before, but I can’t find where…
the desire to update the prt# property of the file when check-in it, based on the value of its doc# variable, adding the file version number to it. i.e. if the file is check-in with the set check mark - overwrite latest version, then the add-in should take this into account, and take the number of the future version after check-in to generate prt#. i.e. either +1 or +0.
that is, if doc# = 100424 and the current version of the file is 03, then:
if we do not check the checkbox when check-in - overwrite latest version, then we get prt# = 100424-04
if we check-in with overwrite latest version, then prt# = 100424-03
Edmrip_CheckOverwriteLatestVersion 29 = R+W; Boolean; overwrite the latest version of the file with the new changes instead of creating a new version?
Edmrip_VersionNew 10 = R; integer; Check In container; next version of the file
(or Edmrip_VersionLatest )
in case of Edmrip_CheckOverwriteLatestVersion i always receive false to out variable. even if i chose “overwrite file version” in check-in window before PreUnlock hook executed.
and in case Edmrip_VersionNew, i receive number which is does not affect on “overwrite file version” checkbox.
i think it is because i cast an IEdmBatchUnlock object to a pointer to IEdmRefItemContainer to get properties in hook…
any suggestions? do this in PostUnlock and add new automatic check-out/in operations with version overwrite with new property part#? and only for files that send to “upd PN” state… do not like this variant)))
what I want to implement:
the file has two variables. doc# and prt#. doc# is a serial counter, with unique values. let doc# specific file will 103423. prt# it is automatically generated by ADDIN **prt#=doc#+version# ie prt# = 103423-03 for version# =3
and I want to make an addin that would be update value prt# in accordance with the future version of the file after check-in. planning to using the hook EdmCmdType.EdmCmd_PreUnlock
i.e. if we select the checkbox “overwrite version”, or assigning a new version, respectively, and then prt# should update its value.
but how to determine the future version of the file from the hook after check-in triggered… after all, this hook is triggered when I have already selected / not selected the checkbox in the file registration form responsible for overwriting the version or increasing its number.
theoretically, since we are sitting in a hook that worked AFTER selecting the registration options in the window, but before the actual registration, then somehow we should be able to find out the future version number of the file, because everything has already been decided in the registration window what will happen to the file version, and this information should be stored somewhere… that’s just where?)
buuut… if user set checkbox “overwrite current version” in check-in dialog, then new version number of the file will be left the same on server. and if i make +1 to current version in hook EdmCmd_PreUnlock, then in my populated property value will be 100342-02 and not 10234-01 as expected due to version overwriting.
yes, we can prevent users from overwriting versions of files for which the property is generated… but this is not exactly what I would like.