AnsweredAssumed Answered

Creating custom rule with Java code

Question asked by amitev on Mar 10, 2011
Latest reply on Nov 15, 2011 by tfrith
Hi all! I tried the following in my environment   

Action action = actionService.createAction(AddAspectActionExecuter.NAME);

Rule rule = new Rule();
rule.setTitle("my Rule");
ruleService.saveRule(nodeRef, rule);

and later i try to get the rule to assert that it exists with the following code:

Rule rule = ruleService.getRule(nodeRef); //the nodeRef instance is the same used for rule save

When getRule() is called i get the following exception:

org.alfresco.service.cmr.rule.RuleServiceException: 02100001 Rule exists without a specified action
   at org.alfresco.repo.rule.RuleServiceImpl.getRule(
   at …..

Idea what I am doing wrong?