Creating Execute Script Action for Rule Service

cancel
Showing results for 
Search instead for 
Did you mean: 
piyush48
Established Member

Creating Execute Script Action for Rule Service

Hi All,

I am trying to create rule through Alfresco RuleService API and has created basic of rule but want to create action which execute javascript present in Datadictionary/Scripts.

Below is my rule method:- 

private void createRule(NodeRef ruleFolder) {
  	  Rule rule = new Rule();
  	  rule.setRuleType(RuleType.INBOUND);
  	  rule.applyToChildren(false);
  	  String title = "Rule for Creation";
  	  rule.setTitle(title);
          rule.setAction(getCompositeAction());
  	  this.serviceRegistry.getRuleService().saveRule(ruleFolder, rule);	

Can someone help me with creating compositeAction which execute script when condition "document is created or enter this folder" which is  present in Rule template when we create manually. Also how to execute error.js to it when error occures similar like when we use Rule template.

 

Please do help me out.

 

Thanks and Regards,

Piyush

3 Replies
cristinamr
Advanced

Re: Creating Execute Script Action for Rule Service

Hi!

Maybe this tutorial can help you.

Cheers!

--
VenziaIT: helping companies since 2005! Our ECM products: AQuA & Seidoc
piyush48
Established Member

Re: Creating Execute Script Action for Rule Service

Hi @cristinamr ,

Thanks, that was really helpful . Am looking into it to develop for Execute script options. If you could help anyway will be great.

Thanks for the help again.

 

Thanks,

Piyush

cristinamr
Advanced

Re: Creating Execute Script Action for Rule Service

I'm glad that tutorial help you.

Concerning last question: what are you looking for exactly? What is your expectation?

I'll give you some tutorials where explains the different options you have available:

https://docs.alfresco.com/content-services/6.2/develop/reference/web-scripts-ref/#understanding-web-...
https://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html
https://docs.alfresco.com/content-services/6.2/develop/repo-ext-points/web-scripts/

 

Give me more details about what is your expectation and I'll try to help you Smiley Very Happy

Cheers!

--
VenziaIT: helping companies since 2005! Our ECM products: AQuA & Seidoc