3

How I can add actions in the Rules module in which they have a relationship with each other sequentially.

I mean a 1st Rules Action sequentially passes data to a next Rules Action and in that next Rules Action I can use those passed data from previous data.

enter image description here

  • what you mean " they have a relationship with each sequentially" ? you want pass data from action1 to action2 ? – Yusef Aug 27 '15 at 5:07
  • Yes! Can you help me alright – Lê Quang Tú Aug 28 '15 at 2:44
0

I think you can pass data with Variables , in one action set variable(s) and in next action get that variable(s),this have one bug if concurrent event occur data will return mistake values, a solution for this is using unique variable name per user(or action), I get you a clue (maybe you get idea from it)

in Action1
set Php action

 global $user;
 // some job here 
 // $result= .....
 variable_set("action1_result-".$user->uid, $result);

in Action2
set Php action

 global $user;
 variable_get("action1_result-".$user->uid);
|improve this answer|||||
  • I will try to apply what you say. Thank you very much – Lê Quang Tú Aug 28 '15 at 6:50
  • @LêQuangTú you're welcome :) – Yusef Aug 28 '15 at 6:51
  • good idea vote up – David Mcsmith Aug 29 '15 at 10:04
0

Assumption:

Your rule has 2 Rules Actions (Action 1 and Action 2). And you want to pass "some data" created by Action 1 as input to Action 2.

Solution:

  1. Create a Rules Component which does the same as "Action 1", say you name it "RulesComponentAction1".

  2. Create a Rules Component which does the same as "Action 2", say you name it "RulesComponentAction2".

  3. Adapt your original rule so that you replace Action1 in it by the execution of Rules Component named RulesComponentAction1.

  4. Adapt your original rule so that you replace Action2 in it by the execution of Rules Component named RulesComponentAction2.

  5. Improve your RulesComponentAction1, by adding within its Settings an extra variable with Usage=Provided (and whatever Data Type that fits your needs). Say you name it VarFromAction1.

  6. Improve your RulesComponentAction2, by adding within its Settings an extra variable with Usage=Parameter (and a Data Type that matches the data type you selected in the previous step). Say you name it VarForAction2

  7. Adapt your original rule so that you pass the extra parameter VarForAction2 to your Rules Component RulesComponentAction2, using as a token ... you guessed it ... the value of VarFromAction1.

Note: By using the Rules Session Variables module you might be able to further extend the above solution to 2 separate rules that get executed one after the other.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.