1

So what I'm trying to do seems pretty simple. And I've found lots of posts similar to it but none have really helped me.

I have a an application content type, when somebody submits it, I'd like to use the rules module to create a post in the forums that has either a.) a link to the application b.) the data from the application in the body of the forum post.

I've figured out how to create a forum post each time the application is saved. Seems to be working ok. I've also figured out how to set the body to be either a static message, or the contents of ONE of the fields from the application.

What I cant figure out is how to either combine fields from the application to set the forum body to (which i'm guessing is a more complex thing), or to simply have a link to the application be what is put in the body of the forum message, which seems like it should be simple. I've looked at the rules faq at https://groups.drupal.org/node/15542 but it seems to think that i should have a NID option in the selector which i do not. (yes its set to trigger after save)

My data selector for setting the body field of the forum entity only includes site, node, and entity. And the Node options are only the individual fields of the application. It doesnt include any NID or options to link the the node itself. I choose other options like convert data type i can find UID and URL options, but then I don't know how to use the variable in the set data action.

I'm guessing that it has to do with the type of the body field and its only showing me things of the same type and i have to convert the UID/URL or something, but apparently I'm slow, anyone want to point me in the right direction?

My current rule (in export format):

{ "rules_test_application" : {
"LABEL" : "test application",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "node_insert--guild_application" : { "bundle" : "guild_application" } },
"IF" : [
  { "node_is_of_type" : {
      "node" : [ "node" ],
      "type" : { "value" : { "guild_application" : "guild_application" } }
    }
  }
],
"DO" : [
  { "entity_create" : {
      "USING" : {
        "type" : "node",
        "param_type" : "forum",
        "param_title" : "New App: [node:title]",
        "param_author" : [ "site:current-user" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },
  { "data_set" : { "data" : [ "entity-created:language" ], "value" : "en" } },
  { "data_set" : { "data" : [ "entity-created:taxonomy-forums" ], "value" : "9" } },
  { "data_set" : {
      "data" : [ "entity-created:body" ],
      "value" : { "value" : {
          "value" : "link to application that generated this post",
          "format" : "Plain_text"
        }
      }
    }
  }
]
}
}
1
  • I added the rule that i currently have that creates a forum post every time an application is submitted. Commented Aug 26, 2017 at 18:17

1 Answer 1

0

Entity-created:body was a formatted text type. Because of that the rules selector was only showing values from the Node that were also Formatted text.

Once I changed the data value i was modifying to entity-created:body:value, the text part of the formatted text, it allowed me to select more things in the selector including the node:url.

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.