2

I have a rules component that i want to trigger on specific time that is set by end user. in my case i have a form where user create rental property and select the rent date there. then i have another form of alerts where user can set alerts related to rentals. like user wants alert before 2 days of rental date. I am able to set the rental date but unable to get the value of alerts section to check what value the end user has set to get an alert. I tried to put sql query in 'PHP Evaluation section' but in scheduling section it shows the blank date. Rule that i have creatrted:

enter image description here

component: Schedule reminder to end user Rule: Schedule rental alerts action: schedule component evaluation data-selector:node:field-rental-start-date php evaluation: $query = db_query("SELECT field_days_before_the_rent_value FROM field_data_field_days_before_the_rent"); foreach($query as $result){$res = $result->field_days_before_the_rent_value;} return $value - $res;

Please help me here how i can get the field_days_before_the_rent_value.

Rental Form

Alert Section

  • What are the field values for rent date and alerts? If the data is tied together you should be able to create another rule to reference data from one node type to another. Give that a higher weight than your current rule. From there you could add a condition to trigger based on php date comparisons and token fields. Your action could then consist of tokens. – pokermoneyclips Dec 12 '13 at 18:03
1

After struggling so many days I found the solution that how we can do scheduling using php evaluation. To do this I have simply pick the value in data selector(under my rule) that is set by user in his rental form as shown in my 1st screen short. Now I need to schedule that rental date according to the alerts set by user in alert section (screen short2) where i was stuck.Under PHP evaluation section we have to use $value variable that returns the value that we selected in data selector.In case of dates it returns the timestamp not the actual date. So then I used PHP code to add/substract the days according to the user set in alert section and succeed to do scheduling.

I hope it will helpful for others.

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.