cancel
Showing results for 
Search instead for 
Did you mean: 

unique problem with webscript

kamal_ravichand
Champ in-the-making
Champ in-the-making
HI all,

i have created a inbound rule which "executes a script" when items are imported to a space, the script file contains the following:

document.name=document.properties["sys:node-dbid"] + "_" + document.name;

now what happens is whenever i import a ".txt" file in to the space, "db-id" is appended along with the name,
for example the name changes to "3241_abc.txt" when i import "abc.txt" to the space.

but the problem is when i import ".jpg" or ".doc" in to the space "db-id" is not appended along with the name.
for example when i import "nature.jpg" to the space the name is not changed which is supposed to change like "3255_nature.jpg"

dont know wats the problem…

any help??
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
When you configured your rule action, did you set the filter to "All items" or items of a specific mime type? Maybe you inadvertently chose a specific mime type and that's keeping your rule from firing for images.

If that's not it, make sure your rule is firing. Add a logger.log("Made it this far"); kind of statement to your server-side JavaScript. Then edit log4j.properties to make sure you've got a logger enabled for server side javascript:
log4j.logger.org.alfresco.repo.jscript=debug
Also, if you'd like to step through your JavaScript when it fires, you can turn on the Rhino debugger:
log4j.logger.org.alfresco.repo.web.scripts.AlfrescoRhinoScriptDebugger=on

Now add your image to the folder and watch the log/debugger to see what happens.

Hope that helps.

Jeff

kamal_ravichand
Champ in-the-making
Champ in-the-making
HI jeff,

thanks for the reply  😎

i have mentioned "All items" already but its not working.

i followed your instructions, the java script is not triggering when i import jpeg file,
and please note: the sample "backup.js" present in Companyhome/Datadictionary/scripts space also does not trigger for jpeg files but it triggers when i import "txt" files, meaning backup folder and backup of jpeg file is not done.

one more query…does jpeg do not fall under "document" type/category ? since the script is :
document.name=document.properties["sys:node-dbid"] + "_" + document.name;   and that's the reason the script is not triggering??


kamal