Call a repository webscript from a rule script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2015 11:56 AM
Hello,
I want to call a repository webscript in a rule js,so i put:
After that i have an error message telling me that "remote" is undefined .
Any idea Please?
I want to call a repository webscript in a rule js,so i put:
var connector = remote.connect("alfresco"); var json = connector.get("/auditexample/createdDocuments.json");
After that i have an error message telling me that "remote" is undefined .
Any idea Please?
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2015 03:59 AM
Hello,
it does not make much sense to call a Repository web script from a rule. The rule is already being executed on the Repository and can do anything the web script can do. The root object "remote" is not available on the Repository tier by default, which is why this attempt fails from a technical perspective.
Regards
Axel
it does not make much sense to call a Repository web script from a rule. The rule is already being executed on the Repository and can do anything the web script can do. The root object "remote" is not available on the Repository tier by default, which is why this attempt fails from a technical perspective.
Regards
Axel
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2015 04:38 AM
Hello AFaust,
I have to go through a rule to call my repository webscript, so my question Please is : It is possible to make the Object "remote" available in my JS rule or not?And if possible how can i do it?
Thanks!
I have to go through a rule to call my repository webscript, so my question Please is : It is possible to make the Object "remote" available in my JS rule or not?And if possible how can i do it?
Thanks!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2015 11:55 AM
Hello,
your rule already is IN the Repository. Why call a web script if your rule can already contain the logic you need to execute? If you want to avoid duplication of code, simply extract logic to a JS library file which you can include in your rule JS via <blockcode><import resource=""></blockcode>.
If you really must, you may be able to make the "remote" object available by reconfiguring the Spring context. Simply add <blockcode><entry key="remote" value-ref="webframework.webscripts.scriptremote" /></blockcode> as a "scriptObject" to the bean "webscripts.container". Best you copy the bean from web-scripts-application-context.xml into an override in your extension directory.
You may also have to add a <blockcode><alfresco-config></blockcode> config file for configuring the "Remote" endpoints.
Again: You do not need "remote" to execute Repository code - simply use a JavaScript library file for common code. Using "remote" to call a Repository web script is like trying to call yourself on your phone to tell yourself to do something you could instead be doing already…
Regards
Axel
your rule already is IN the Repository. Why call a web script if your rule can already contain the logic you need to execute? If you want to avoid duplication of code, simply extract logic to a JS library file which you can include in your rule JS via <blockcode><import resource=""></blockcode>.
If you really must, you may be able to make the "remote" object available by reconfiguring the Spring context. Simply add <blockcode><entry key="remote" value-ref="webframework.webscripts.scriptremote" /></blockcode> as a "scriptObject" to the bean "webscripts.container". Best you copy the bean from web-scripts-application-context.xml into an override in your extension directory.
You may also have to add a <blockcode><alfresco-config></blockcode> config file for configuring the "Remote" endpoints.
Again: You do not need "remote" to execute Repository code - simply use a JavaScript library file for common code. Using "remote" to call a Repository web script is like trying to call yourself on your phone to tell yourself to do something you could instead be doing already…
Regards
Axel
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2015 02:47 AM
Hello Axel,
Yes that's it! i should change the process,maybe i should make a custom action ,thank you very much!
Yes that's it! i should change the process,maybe i should make a custom action ,thank you very much!
