cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript rules that undo or cancel inbound actions

raarm
Champ in-the-making
Champ in-the-making
Hi everyone,

I need to crate a rule in javascript that cancel a inbound action. For example….I have a condition:

var name = document.properties.name;
if(name.equals("test"))
{
…….
}
else
{
[b]the code that cancel the action[/b]
}

The system can´t record the file in folder. I need cancel the action.

thanks
7 REPLIES 7

xerox
Champ in-the-making
Champ in-the-making
Hi,

you could create an inbound rule that only execute the actions if name = "test*"
You could do this by selecting the condition = items that contains a specific value in its name.

Friendly regards,

Nick

raarm
Champ in-the-making
Champ in-the-making
Thanks Nick,

But I dont understand…How I can do this?
Do you have a example?

:roll:

xerox
Champ in-the-making
Champ in-the-making
Hi,

I also think I've misunderstand your question.
What do you mean with cancel an inbound action?
A delection of those incoming file?

friendly regards,

Nick

raarm
Champ in-the-making
Champ in-the-making
Hi,

When I say "inbound actions"…..I'm referring to rules on entry of files!
I need to cancel the action to place the file(move,copy..) If in my case the file does not have the name "test", he cancels the action of the file entry. only this!!

I need this rule to use it in the WINDOWS(CIFS). Do you know how I use "alerts"? windows SO that show error messages

I tried:
 alert ( "error");

but gave no!

thanks Nick!

cbosdonnat
Champ in-the-making
Champ in-the-making
I need to cancel the action to place the file(move,copy..) If in my case the file does not have the name "test", he cancels the action of the file entry. only this!!

You will not be able to skip or undo the action from a JavaScript rule. In order to do this, I would create a Spring interceptor that is simply not doing the action. The problem is that you have to intercept every inbound method… to do this. You should search in Alfresco spring configuration files (*-context.xml) for interceptors definitions: one is really interesting is the audit interceptor. To do this you will need some knowledge of the Alfresco Java API and basic knowledge of spring configuration.

I need this rule to use it in the WINDOWS(CIFS). Do you know how I use "alerts"? windows SO that show error messages

These message dialogs are special frames in the SMB protocol and very low level. The only way to see how it is done is to have a look at the Desktop actions implementation.

raarm
Champ in-the-making
Champ in-the-making
I tried to use the Alfresco JavaScript Debugger … without success!
Is he the only tool for testing the codes in Alfreco? Is there a tutorial that teaches the use it ?
Im not test my codes before placing them in the rules!

cbosdonnat
Champ in-the-making
Champ in-the-making
Hi,

I've tried to use the debugger several times, but without success… However, you can trace what happens in your javascripts by using the logger API. To output the traces in the alfresco.log, you have to uncomment the following line in the tomcat/webapps/alfresco/WEB-INF/classes/log4j.properties file:


#log4j.logger.org.alfresco.repo.jscript=DEBUG

HTH