Hi guys.
I'm trying to create a rule triggered after a node is created and with an action to create a comment on this node.
The comments include a couple additional fields (text, file, etc) , and i need to set some of these with data from the node.
But the data selectors to specify the data to be set does not includes the entity created additional fields, it just lists standard comment fields as author, subject , body, etc.
Similar problem when trying to add an item to a list of files on the comment. There is no data selector available for it.
Is this supposed to work? I'm doing something wrong?
Thanks a lot.
Comments
Comment #1
itangalo commentedTo use the fields, you must add conditions that verifies that the fields exist on the enitities you're handling. Some more information about this can be found in this screencast: http://nodeone.se/node/987
I hope it may be of help.
//Johan Falk, NodeOne, Sweden
PS: I'm not maintaining the Rules module, just helping with support questions. You are welcome to ask more questions at http://groups.drupal.org/rules
Comment #2
itangalo commentedComment #4
chi commentedHave the same problem. I am trying to set comment body from with data from node (field_status is a single texfield).
When I save the rule above I got this error message:
Integrity check for the imported configuratoin failed. Error message: The data type of the configured argument does not match the parameter's param_comment_body requirement..
Comment #5
itangalo commentedI think the comment body has two parts – the text format and the actual text. Try inserting the text in the 'value' part of the body, and I think this should work.
Comment #6
chi commentedI don't got hang of this.
Here my current rule:
Field status is a simple text list. I was able to set comment subject from field_status but not comment body. Because I could not find suitable token in data selectors section (see screenshot). "node:body" is only thing that I was able to set for comment body.
Comment #7
chi commentedscreen
Comment #8
itangalo commentedHm, you should get more data avilable if you drill into
node:body:. (Note the trailing colon!) This assumes that the body is *formatted* text, not plain text.Basically, what you got is this:
A formatted text has
body:formatandbody:value.A plain text has only
text.If you try to set a plain text value, you must input a matching data – such as
body:value.I recommend using the dropdown on the right side of the data selector, rather than the list of data selectors below the widget. (Actually, that list should probably be removed.) If you use the data selector to drill down into the available data, you will get more useful lists of data.
(Note that if your status field is *not* a plain text field – for example an integer field or a list of text – Rules won't accept text data as input for it. There are ways to work around this, too.)
Comment #9
itangalo commentedHere's a screencast explaining a bit more about the data selector: http://dev.nodeone.se/en/data-types-and-data-selection
Comment #10
chi commentedThanks! I've seen all your screencasts about rules module. As far as I understood it param_comment_body doesn't assume any data types except 'formatted text'. It isn't possible to set directly value or format of the comment body through UI.
Now, I've done it with data_set action. Of course this kind of tricky if you can do it without data_set action please share your rule.
Comment #11
itangalo commentedGreat!
I would have used the 'set data value' action myself, and don't really know how to do it in another way.
Comment #13
Energyblazar commentedhello i am facing a problem which is very similar.
I have added user reference field in the comment form of a group (group created via organic group).
How do i access this extra field it in rules ?
Comment #14
mitchell commentedUpdated component.
Comment #15
tr commentedThis was asked and answered and closed by #12.
It was reopened in #13 for a related issue, but no details were provided (unlike the original issue, where lots of details and exports of rules were posted).
After almost 6 years with no reply, I'm going to assume #13 is no longer relevant - regardless, there is not enough information to address #13, and you should open a new issue with details if this is still a problem.