cancel
Showing results for 
Search instead for 
Did you mean: 

Rule not triggered after specializing type

mkieboom
Champ in-the-making
Champ in-the-making
Hi there,


At the moment I want to configure a rule which send out a notification to a person when content gets a a custom content type assigned.
For example a user upload one particular document A.pdf. At this moment the content type is still cm:content.
However after the content type is specialized to: my:customcontent it looks lik Alfresco does receive this trigger.

Does anyone know how this can be solved?

The notifications itself work so that is not the issue.

Kind regards,


Marcel


Alfresco Community v4.0.0
(3979) schema 5025
10 REPLIES 10

douglascrp
World-Class Innovator
World-Class Innovator
Hi there,

At the moment I want to configure a rule which send out a notification to a person when content gets a a custom content type assigned.
For example a user upload one particular document A.pdf. At this moment the content type is still cm:content.
However after the content type is specialized to: my:customcontent it looks lik Alfresco does receive this trigger.

Does anyone know how this can be solved?

The notifications itself work so that is not the issue.

Kind regards,

Marcel

Alfresco Community v4.0.0
(3979) schema 5025

You can have more than one folder rule configured to the same folder.
The first one is that you described. When a new document is created, its type is configured.

Just create a second rule, registered to run at "items are updated", and the criteria as "content of type or sub-types" type my:customcontent".

mkieboom
Champ in-the-making
Champ in-the-making
Hi douglas,


Thank you for your reply.
I'm not sure if I did something wrong however what I already wrote, and perhaps I did not make it very clear.
It looks like if Alfresco did not receive the update trigger after the type is specialized.

Any idea what the problem could be?

Kind regards,


Marcel

douglascrp
World-Class Innovator
World-Class Innovator
Hi douglas,


Thank you for your reply.
I'm not sure if I did something wrong however what I already wrote, and perhaps I did not make it very clear.
It looks like if Alfresco did not receive the update trigger after the type is specialized.

Any idea what the problem could be?

Kind regards,


Marcel

You are right… I just made a test, and the rules engine seems to ignore the update.

What about creating an second action inside the same rule, executed just after the first one?

You can try to select a javascript to run.

mkieboom
Champ in-the-making
Champ in-the-making
Hi Douglas


Sorry for my delayed response.
I wasn't be able to respond earlier.

Within the rule which checks if a content type is added or updated with content type "type1" I added another rule which executes the following action.
The problem is the same as mentioned earlier. Alfresco does not see the change of content type as an update trigger.


if(document.typeShort == "type1" || document.typeShort == "type2" || document.typeShort == "type3")
{
   // create mail action
   var mail = actions.create("mail");

   // set the required parameters
   mail.parameters.to = "mail@mail.com";
   mail.parameters.subject = "subject";
   mail.parameters.from = "alfresco@alfresco.com";
   mail.parameters.text = "Text Message";
   // execute action against a document   
   mail.execute(document);
}

douglascrp
World-Class Innovator
World-Class Innovator
As I told you before, you can configure 2 actions inside on rule.

I have one case where I have something just like what you want to do.

Take a look at this.
[img]http://i49.tinypic.com/117a6af.jpg[/img]

In this rule, I've specialized the type, and then, I executed a script.

Can you try this?

mkieboom
Champ in-the-making
Champ in-the-making
Hi Douglas,

Thanks for your reply.
I believe that your example will work however you define in your rule which content type it will be.
The problem is, in our situation, the content types can be different and will not be set by a rule, just by hand changing the content type.

I think that is not what you displayed in your screenshot is it?

Kind regards

douglascrp
World-Class Innovator
World-Class Innovator
Ok. I got it.

I didn't know that the type would be set manually…
All the tests I did were made with automatic actions driven by rules.

mkieboom
Champ in-the-making
Champ in-the-making
Ok thanks anyway.
Perhaps I need to find it elsewhere in Alfresco's functionality.
With policies, or scheduled actions…

silverhoof
Champ in-the-making
Champ in-the-making
From my point of view, this looks like a bug.
An update event should be fired whenever the content is modified either by end user or a rule action.