AnsweredAssumed Answered

WebScript: query fails

Question asked by mduduzi on Sep 26, 2012
Latest reply on Oct 15, 2012 by mduduzi
Hi all,

I am new in webscripts. I have created the following components in /com/greenenergy/em/lab3/:

1. Descriptor xml

   <shortname>Get ConfigDoc Test</shortname>
   <description>Get ConfigDoc Test</description>
   <family>Green Energy</family>
   <format default="html"/>

2. Controller js

var serialnum = url.templateArgs["serialnum"];
var docquery = 'select e.* from geem:equipment as e where e.geem:serialnum='+serialnum;
var def = {query:docquery,language:"cmis-alfresco"};
var results = search.query(def);
   doc = results[0];
   model.docnode = doc;
   status.message="Equipment document with serial number: " + serialnum + ", was not found!";

3. Template ftl

<a href="${url.serviceContext}/api/node/content/${docnode.nodeRef.storeRef.protocol}/${docnode.nodeRef.storeRef.identifier}/${}/${}">${}</a>

I am getting the following error when I call the webscipt:

08260046 Wrapped Exception (with status template): 08260338 Failed to execute script '/com/greenenergy/em/lab3/getConfigDoc.get.js (in repository store workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions)': 08260337 Failed to execute search: select e.* from geem:equipment as e where e.geem:serialnum=77777

Please note the I have checked for the existence of geem:serialnum in the custom type geem:equipment. I am using alfresco 4 community.