10-14-2016 09:22 AM
Hi,
How can I invoke an action from another action?
I have an action that extracts metadata from a specific file, another action change type of document in reference to a name.
If a name of this file (A) is the same of another file in another directory, file B ( different file but same name) an existing action must be started on file B.
Is it possible?
If yes, how to.
Thanks
10-14-2016 04:57 PM
Some additional specifics, such as where you are executing the action, what language you wrote the action in, etc., would be helpful, as well as what you have tried so far and any problems you've run into.
But, I will answer assuming you are talking about a rule action. One way to execute any number of actions from a rule is to configure your rule to execute JavaScript. Then, from JavaScript you can invoke as many actions you want on any objects you want.
Here's a little JavaScript snippet I pulled from the docs that shows how to execute an action from JavaScript:
var myCopyAction = actions.create("my-copy-action");
myCopyAction.parameters["destination_folder"] = companyhome;
myCopyAction.parameters["destination_name"] = "Copy of " + document.name;
myCopyAction.execute(document);
In this case, the "document" variable is automatically populated by Alfresco when it invokes the rule. But you could do a search to get another object or whatever you need to, then you could set up as many actions as you want and call execute on those objects.
10-14-2016 11:08 AM
by action you mean an action that is being run upon a configured folder-rule?
you can run a script at the end of execution of a rule.
10-14-2016 04:57 PM
Some additional specifics, such as where you are executing the action, what language you wrote the action in, etc., would be helpful, as well as what you have tried so far and any problems you've run into.
But, I will answer assuming you are talking about a rule action. One way to execute any number of actions from a rule is to configure your rule to execute JavaScript. Then, from JavaScript you can invoke as many actions you want on any objects you want.
Here's a little JavaScript snippet I pulled from the docs that shows how to execute an action from JavaScript:
var myCopyAction = actions.create("my-copy-action");
myCopyAction.parameters["destination_folder"] = companyhome;
myCopyAction.parameters["destination_name"] = "Copy of " + document.name;
myCopyAction.execute(document);
In this case, the "document" variable is automatically populated by Alfresco when it invokes the rule. But you could do a search to get another object or whatever you need to, then you could set up as many actions as you want and call execute on those objects.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.