Import XML

Asking the user to release a document lock

How to make an import of a document “friendly” in case a user has locked that document, so that the user will be asked to release the lock in the editor.

If the importer tries to import a document which is locked by another Sophora user, the importer can ask the user to release the lock using a dialog shown in the DeskClient. To use this feature, include the forceLock field with a timeout attribute. Until the timeout is reached, the importer will show the dialog to the user every two minutes. During this time, the importer will continue to process other imports, if they don't change the same document. Once the user releases the document lock, the importer will continue with the blocked import. In the example below, the importer will try to obtain the lock for 10 minutes:

<?xml version="1.0" encoding="UTF-8"?>
<document nodeType="sophora-content-nt:imageobject"
          xmlns="http://www.sophoracms.com/import/5.0">
  [...]
  <fields>
    <site>news</site>
    <structureNode>/multimedia/bilder</structureNode>
    <idstem>bundesliga</idstem>
    <forceLock timeout="10">true</forceLock>
    <forceCreate>false</forceCreate>
    <channels>
      <enabledChannels />
      <disabledChannels />
    </channels>
  </fields>
</document>

For more details, see the description of the forceLock element.

Last modified on 10/16/20

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.

Icon