<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.setTransactionName.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.setTransactionName</api:function-name><api:suggest>xdmp.settransactionname</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>settransactionname</api:suggest><api:function-link mode="xquery" fullname="xdmp:set-transaction-name">/apidoc/8.0/xdmp:set-transaction-name.xml</api:function-link><api:function mode="javascript" name="setTransactionName" type="builtin" lib="xdmp" category="TransactionBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.setTransactionName"><api:summary>
  Set the name of a local or remote transaction.
</api:summary><api:params><api:param name="name" type="xs:string"><api:param-description>
    The new name.
  </api:param-description><api:param-name>name</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="host-id" type="xs:unsignedLong" optional="true"><api:param-description>
    An optional host ID. If omitted, the local App Server host is assumed.
    If a host ID is given, then a transaction ID must also be given.
  </api:param-description><api:param-name>host-id</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="txn-id" type="xs:unsignedLong" optional="true"><api:param-description>
    An optional transaction ID. If omitted, the current transaction is
    assumed. If a transaction ID is given, then a host ID must also be given.
  </api:param-description><api:param-name>txn-id</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>null</api:return><api:privilege>
  <p xmlns="http://www.w3.org/1999/xhtml"><code>http://marklogic.com/xdmp/privileges/xdmp-set-transaction-name-my</code></p>
  <p xmlns="http://www.w3.org/1999/xhtml"><code>http://marklogic.com/xdmp/privileges/xdmp-set-transaction-name-any</code></p>
</api:privilege><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">If the transaction already has a name, it is overwritten with the
     new name.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
    If the specified transaction does not exist, <code>XDMP-NOTXN</code>
    is raised.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
    If <em>host-id</em> is not found or MarkLogic Server is not available
    on that host, the exception <code>XDMP-HOSTOFFLINE</code> is raised.
  </p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.setTransactionName("myTransaction");
=&gt; Set the name of the current transaction in the current local session
   to "myTransaction".
</pre></api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.setTransactionName("myTransaction",
                            xdmp:host("some-host.marklogic.com"), $txn-id);
=&gt; Set the name of the given transaction on the remote host
   some-host.marklogic.com to "myTransaction".
</pre></api:example></api:function></api:function-page>