2

I have a content type including these two fields

content type fields

and now I want to use those fields in a "Rules" action, but they are not present in the replacement patterns to choose, and they're not present in the Data Selection mode either.

What have I missed? Would appreciate if someone could point me in the right direction.

My rule export code

{ "rules_fiberbest_llningsemail" : {
"LABEL" : "Fiberbest\u00e4llningsemail",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_insert--fiberbestallning" : { "bundle" : "fiberbestallning" } },
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "node" ],
      "type" : { "value" : { "fiberbestallning" : "fiberbestallning" } }
    }
  }
],
"DO" : [
  { "mail" : {
      "to" : "[email protected]",
      "subject" : "Fiberbest\u00e4llning",
      "message" : "Ny fiberbest\u00e4llning fr\u00e5n hemsidan skapad [node:created]\r\n\r\n[node:url]\r\n[node:field-f-rnamn]\r\n[node:field-efternamn]\r\n[node:field-adresss]\r\n[node:field-postnummer]\r\n[node:field-postadress]\r\n[node:field-fibertyp]",
      "language" : [ "" ]
    }
  }
]

1 Answer 1

2

You need to:

Add Condition >> Content is of Type >> [your content type]

OR

Add Condition >> Entity Has Field >> node:field-telefon

Add Condition >> Entity Has Field >> node:field-signatur

OR

Add Action >> Fetch Entity by Property >> Node >> telefon >> node:field-telefon

Add Action >> Fetch Entity by Property >> Node >> signatur >> node:field-signatur

9
  • Hi, and thanks for your reply I tried this, but none of the these adds the fields in the replacement pattern. I can see them just fine in the "Entity Has Field" condition, but they are still not present in the Action.
    – duzzy
    Mar 6, 2016 at 10:33
  • @duzzy that is very odd, can you post the export code of your rule?
    – No Sssweat
    Mar 6, 2016 at 10:37
  • edited original post
    – duzzy
    Mar 6, 2016 at 10:44
  • @duzzy hmmm, not even Add Action >> Fetch Entity by Property worked?
    – No Sssweat
    Mar 6, 2016 at 10:46
  • 1
    My 2 cents (based on my own experience): "entity has field" (for the field you'r interested in) is always the best bet ... To the Rules module it's like saying "hey, I want to do something with that field, please make it available" ... Extra guess: since event in rule here was "after insert of node of type 'fiberbestallning', I bet the Rules condition "if content type is fiberbestallning" is possibly just ignored ... and hence its custom fields are not made available ... Would be interesting to see what happened if event is just without test on type ... Jul 10, 2017 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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