1

I am trying to get option value from node in drupal rules. I have a form-group which consists of fields. The field in question is a select list - it consists of different names, with every option there is an email. They are stored in this way:

0|NONE
example@example.com|EXAMPLE
example2@example.com|EXAMPLE2

So option value for EXAMPLE is example@example.com Let us call this field operator. So I want to send/get email from this node What I have atm in rules is [node:field-operator:value] which does not work. [node:field-operator] for example just fetches the name e.g EXAMPLE. I have tried tons of ways by now but I know that solution must be simple, it's just my first time using drupal and been looking for an answer for hours. Thank you for your help.

  • You may have a bit more luck searching for an answer if you refer to the email storage as a 'key' because that is the standard term for it, each of those items will be stored in an array with the text on the left of the pipe forming the key and the text on the right forming the value. You may even find there is a token for [node:field-operator:key] – Darvanen Sep 10 '14 at 1:00
0

Make sure you already have the Token module installed in your site. The Token module.

  1. on your site go to /admin/config/workflow/rules
  2. Select send an email on the action section of the rule
  3. Click switch to data selection
  4. Click DATA SELECTORS and find your select list Eg:(node:field-select-list) token and add it into To box.

Hope it help

  • Thank you everyone, tried all solutions but token module worked rightaway. Can't add multiple values with data selector but it sends the email now! – Dreamscaper Sep 10 '14 at 9:31
  • @Dreamscaper Glad to know that your problem is solved now, could it be possible to accept the suggested solution. – Yama Sep 10 '14 at 9:33
0

I duplicated your scenario and also could not get the key to be used in rules. There is no token for :key.

However, if you go to the display settings for you content type, you can change the format of your list text field to 'Key' (by default it is Default). Now your rule will use the key value of the pair, instead of the value. This means that when viewing said node it will also display the key (ie. email) part of your field, and only when editing or adding said content will the list box use the value part of the pair.

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.