Working with checked Out objects

The Connector will detect objects that is checked out. When updating from M-Files to SQL nothing will be updating and the last record for the object in the class table will be retained. When updating from SQL to M-Files the process_id will remain 1 and no update would take place. The return value of the update procedure will be 3, the next time the record is updated, it will be re-evaluated and if checked in, the update will take place.

It is not possible to force a check in or undo a check out using the Connector.

To detect if a checked out object have been encountered, the update procedure must be evaluated. The following procedure capture the return value of the update procedure. If the result is 3 then a checked out item was detected.

DECLARE @return_value int
EXEC @return_value = spmfupdatetable MFcustomer,0
SELECT @return_value

The object that is checked out can be detected in the spMFAuditHistory

SELECT * FROM dbo.MFAuditHistory AS mah
WHERE mah.Class = 78 --MFCustomer class id
AND mah.StatusFlag = 3

Checked out items can also be detected with the following

Orphaned checked Out objects

In some cases spMFAuditHistory will include checked Out objects, however, when checking M-Files the objects are not visible to the user. This is due the item created but not yet checked in by the intergration user, and therefore only visible to the integration user local machine.

Orphaned objects can arise if the connection to M-Files is interupted between the time that the integration user has created the item, and checked the items back in. This is especially relevant for batch updates and occasionally happens.

It is highly likely that the object was created but never checked in. These objects can only be detected in the M-Files SQL Database as it is not possible to log in as the integration user desktop.

Use YourVaultMFilesDatabase
select  *  from [dbo].[OBJECTTYPEITEM] where CHECKEDOUTVERSION is not null

The workstation and user that checked out the object can be detected from this table. Normally this view will show any objects that have been created by users, but never checked in. Any items with the integration user is likely to be orphaned.

The Connector does provide utilities to remove orphaned objects where the user or workstation is no longer available to check in these objects. To remove checked out objects one of two routes can be followed.