Hi Siva, Is this an xqy module inside MarkLogic? It will probably run the xdmp:spawn-function when producing the HTML, rather than on-click. I think you better use a href that links to the page itself with a request-param indicating some action is required, and handling that elsewhere in that code, or make the link point to a different module that will execute the task..
Re preventdeadlocks: you can disable the safeguard with the <prevent-deadlocks> option, see also http://docs.marklogic.com/xdmp:eval.. Cheers, Geert From: <general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>> on behalf of "Mani, Sivasubramani (ELS)" <s.m...@elsevier.com<mailto:s.m...@elsevier.com>> Reply-To: MarkLogic Developer Discussion <general@developer.marklogic.com<mailto:general@developer.marklogic.com>> Date: Wednesday, June 15, 2016 at 9:24 AM To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" <general@developer.marklogic.com<mailto:general@developer.marklogic.com>> Subject: [MarkLogic Dev General] Regarding XDMP-PREVENTDEADLOCKS Hi team, I got the XDMP-PREVENTDEADLOCKS error while I try to call a marklogic function inside the Html hreaf onClick event. Kindly guide me how to achieve this. Code: <dt>Delete</dt>, <dd>{ let $userId := auth:get-current-user-id() let $batchId := xs:string(data($batch/@id)) let $batchDocUri := batlib:get-batch-xml-uri($userId, $batchId) let $batchDirUri := concat("/repo/user/", $userId, $const:PATH-SEP, $batcon:BATCHES, $const:PATH-SEP, $batchId, $const:PATH-SEP) return <a href="{$const:BATCH-LIST-URL}" onClick="{ xdmp:spawn-function(function() { let $deletebBatchDir := try { xdmp:directory-delete($batchDirUri) } catch($e){ "" } return (if(doc-available($batchDocUri)) then xdmp:document-delete($batchDocUri) else(),xdmp:commit()) },<options xmlns="xdmp:eval"> <transaction-mode>update</transaction-mode> </options>) Error Message: <error:code>XDMP-PREVENTDEADLOCKS</error:code> <error:name/> <error:xquery-version>1.0-ml</error:xquery-version> <error:message>Processing an update from an update with different-transaction isolation could deadlock</error:message> <error:format-string>XDMP-PREVENTDEADLOCKS: xdmp:invoke("/application/views/batch/available-batches.xqy", (fn:QName("", "view-data"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:map="http://marklogic.com/xdmp/map"><map:entry key="batchType"><map:value xsi:type="xs:string">norma...</map:map>), fn:QName("", "form-data"), ...), <options xmlns="xdmp:eval"><isolation>different-transaction</isolation><prevent-deadlocks>t...</options>) -- Processing an update from an update with different-transaction isolation could deadlock</error:format-string> <error:retryable>false</error:retryable> Thanks & Regards, Siva
_______________________________________________ General mailing list General@developer.marklogic.com Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general