AnsweredAssumed Answered

Document action in Share to call json webscript of Alfresco

Question asked by agey on Mar 18, 2013
Latest reply on Mar 21, 2013 by agey
Hi all,

I have a webscript created in Alfresco to return json data about a document. Now I want to call this webscript from Share in a menu link of each document but I don't know how do it. I created a action in share-config-custom.xml:

<action id="sm.doclib.action.detail.sending.e-invoices"
   icon="detailed-view-on"
   type="pagelink"
   label="actions.document.detail.sending.e-invoice">
      <param name="page">/components/emfra/detailSendingeInvoice?nodeId={node.nodeRef}</param>
      <evaluator>evaluator.doclib.metadata.factura.emitida</evaluator>
</action>


detailSendingeInvoice.get.js

<javascript>
var connector = remote.connect("alfresco");
var data = connector.get("/emfradetail?nodeId=e2c2eca2-d54b-4584-a182-f33d55c6bd3f");

if (result.status != status.STATUS_OK)
{
   status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Unable to call emfradetail data webscript. " +
                  "Status: " + result.status + ", response: " + result.response);
   return null;
}

var result = eval('(' + data + ')');
model.fradetail = result["fradetail"];
model.emfradetail = result["emfradetail"];
</javascript>

detailSendingeInvoice.get.desc.xml


<webscript>
   <shortname>Detalle facturas emitidas</shortname>
   <description>Muestra el detalle de los envíos de las facturas emitidas</description>
   <url>/components/emfra/detailSendingeInvoice?nodeId={nodeId}</url>
</webscript>


When I click on the link in the document menu, Share returns an error:

javax.servlet.ServletException: Could not resolve view with name 'site/empresa-1/components/emfra/detailSendingeInvoice' in servlet with name 'Spring Surf Dispatcher Servlet'

Can anyone guide me to solve this?

Thanks a lot in advance,

Outcomes