AnsweredAssumed Answered

Webscript not running with post.json.js

Question asked by rcrittendon on Mar 19, 2010
Latest reply on Sep 23, 2016 by alch3mi5t
I am running a small example in Alfresco 3.2.  The issue I am running into is that I cannot call the script if the javascript file ends in post.json.js, but can if it ends in post.js

If I call http://localhost:8080/alfresco/service/hmm/testIssue?alf_method=post with the javascript file ending in post.json.js I get the following sort of error.
'Expression results is undefined on line 2, column 18 in testIssue\/test-issue.post.json.ftl.'

Is there something I should add to get that.  It looked like it should be possible when reading http://wiki.alfresco.com/wiki/Web_Scripts#Request_Processing.

test-issue.post.desc.xml
<webscript>
  <shortname>Test Webscript</shortname>
  <description>Test webscript for result</description>
  <url>/hmm/testIssue</url>
  <format default="json"/>
  <authentication>user</authentication>
</webscript>

test-issue.post.js (what I wanted as test-issue.post.json.js)

function main(){
   model.results = "hello";
}
main();

test-issue.post.json.ftl

{
    "results":"${results}"
             
}

Outcomes