I have a use case where a rule is evaluated and the result has to be returned to invoker (a kind of return value action)
Does rules design support returning values to invoker ?

Here is a concrete example (actually trying to write some ubercart integration) :
I have a product that can be added to (uber) cart only if a rule is met :
- I created an event 'An item is being added to the cart'. + a few conditions (like cart contains product x)
- I invoke this event inside my implementation of the cart_add_item hook from uc_cart. When implementing this hook you should return TRUE or FALSE to tell uc_cart if it can/must-not add the product to the cart.

What i want to say is that there is no callback in this scenerio and you have to return a value while your on the stack. Check it out here for more info

Comments

redben’s picture

Component: Rules Core » Rules Engine

I have found a workaround for this. Not elegant but should work. Create a global variable before invoking the rule set and add an action to set that global variable's value.

amitaibu’s picture

Version: 6.x-1.1 » 6.x-1.x-dev

AFAIK this is planned for Rules2

redben’s picture

Do you have any idea on when Rules 2 dev is going to start ?

fago’s picture

Category: support » task

Yep, that's planned. Rule2 dev already started.

mitchell’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev

@fago: Please update status.

fago’s picture

Status: Active » Fixed

rules2 already supports providing new variables with rules sets. :)

redben’s picture

@fago greate !

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.