Request in Alfresco database
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2014 11:59 AM
Hi, i am really new in alfresco and
I am having problems to make requests in alfresco database.
i am using alfresco 4.0.2 and a postgresql database
I followed this tutorial: http://wiki.alfresco.com/wiki/3.4_JavaScript_API,and created a simple js file for the request.
function requestSearch(){
var nodes = search.luceneSearch("TEXT:alfresco");
return nodes;
}
$(function() {
$("#articles").click( function(){
alert( requestSearch());
});
});
with just a simple request to display alfresco text.
but it doesn't work, and when i debug, an error is shown at the import of librairies.
i checked the location of theses libraries files in "/Company Home/Data Dictionary/Scripts/, but they don't exist in that location and i didn't manage to find where they are.
Does anyone know where are they located?
or am i on the wrong way to make requests in database
Thx
I am having problems to make requests in alfresco database.
i am using alfresco 4.0.2 and a postgresql database
I followed this tutorial: http://wiki.alfresco.com/wiki/3.4_JavaScript_API,and created a simple js file for the request.
function requestSearch(){
var nodes = search.luceneSearch("TEXT:alfresco");
return nodes;
}
$(function() {
$("#articles").click( function(){
alert( requestSearch());
});
});
with just a simple request to display alfresco text.
but it doesn't work, and when i debug, an error is shown at the import of librairies.
i checked the location of theses libraries files in "/Company Home/Data Dictionary/Scripts/, but they don't exist in that location and i didn't manage to find where they are.
Does anyone know where are they located?
or am i on the wrong way to make requests in database
Thx
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2014 05:30 AM
You are using this wrongly. You are using it as normal client side javascript but this functions are of alfresco javascript and you would be able to execute them on server side only.
So you need to first created independent script using those apis as shown in cookbook.
Test it by uploading them under script folder in alfresco then run action to execute that script.
Then you can hook that script with any of rule in alfresco.
So you need to first created independent script using those apis as shown in cookbook.
Test it by uploading them under script folder in alfresco then run action to execute that script.
Then you can hook that script with any of rule in alfresco.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 04:06 AM
Thank you for your advice, it is a little bit clear now but not quite clear.
Can i have one clear example or tutorial to make it work?
Thanx
Can i have one clear example or tutorial to make it work?
Thanx
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 08:37 AM
In your code
which is is client-side JavaScript ,it will only run in your browser.
But the import command and search object should be ran in server side and executed in the alfresco repository context
$(function() {$("#articles").click( function(){alert( requestSearch());});});
which is is client-side JavaScript ,it will only run in your browser.
But the import command and search object should be ran in server side and executed in the alfresco repository context
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 01:15 PM
Thank you kaynezhang, your post was really helpful, and i know now what path to take.
but i still facing a problem, i followed this tutorial about creating a JS server-side script ( http://www.packtpub.com/article/alfresco-3-writing-executing-scripts ).
i loggedin as admin and i created a JS file (transform.js) in the script Folder under company home. but when i try to run my script, et when i reached the "select a script to execute", i don't see my script in the dropdown box. i restarted the server, but still nothing.
Am i missing something?
thanks in advance!
but i still facing a problem, i followed this tutorial about creating a JS server-side script ( http://www.packtpub.com/article/alfresco-3-writing-executing-scripts ).
i loggedin as admin and i created a JS file (transform.js) in the script Folder under company home. but when i try to run my script, et when i reached the "select a script to execute", i don't see my script in the dropdown box. i restarted the server, but still nothing.
Am i missing something?
thanks in advance!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 11:07 PM
Make sure your js file is placed under /Company Home/Data Dictionary/Scripts and make sure you transform.js's mime type is "Java Script"
If the content type is plain text or html. It won't be seen .
you can edit the content type to javascript by clicking "View Details" and click "Modify"
If the content type is plain text or html. It won't be seen .
you can edit the content type to javascript by clicking "View Details" and click "Modify"