Hi,
I've an issue when I 'create an entity' (node). The 'set domain to node' doesn't result in the expected 'publish to' selected in the saved node.
When I run an existing node through the same rule, the 'set domain to node' is working as expected and results in the correct 'publish to' setting. So the solution should be in the difference between create/update an entity through rules.
I've tried to figure out - for many hours - what it is. It actually seems (from one test) that 'domains' is set correctly when building up the entity (node) in rules, but than that setting is lost as it doesn't show up in the saved node. I believe the default domain settings are applied, so I assume that on node save there are no domains settings available. But where are they lost?
Hope someone can help!? Is it really a domain_rules issue, or should I post this in rules or entity? Currently setting this to 'bug', not sure if it is actually one.
Thanks for any suggestion/help in the matter.
Roen
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | Component Export 2 rules.txt | 3.07 KB | roeneman |
| #4 | Component Export.txt | 1.65 KB | roeneman |
Comments
Comment #1
shushu commentedHi Roen,
To clarify the bug/requirement - instead of "set domain to a node", you are looking for "set domain to an entity" (and you see that now, even if the entity IS node, it does not work).
Is this the correct definition of the problem ?
Since I didn't test for entity creation, I guess it is reasonable to think it won't work (especially since the code is just a port from D6 - the entity-less version...).
I will try to find some time and solve this.
Regards,
Shushu
Comment #2
roeneman commentedHi Shushu,
Thanks a million for replying so promptly. So yes, your assumption is right and I see now my mistake in thinking.
It would be great if you could solve this. I'm working with mailhandler/feeds to get the data in and need to establish through rules to what sites to publish. So its kind of vital to my setup.
Unfortunately I'm not a programmer so can't really be of assistance. But from what I believe to understand of it, rules needs the domain_id be fed as property via entity_metadata_wrapper(). From thereon I'm totaly lost ....
Thanks for helping out.
Roen
Comment #3
shushu commentedHi Roen,
I installed a clean D7 with Rules, Domain and all dpendencies, trying to look in the situation at hand.
I can't find any Rules action related to entity in general - there is no "when entity is saved" action.
Do I miss anything ?
Can you export the rule you have and send it to me ?
Comment #4
roeneman commentedHi Shushu, great you found time to look into this already. See attach for the export of the component.
Regards, Roen
Comment #5
shushu commentedok, so you are not rtiggered by an entity creation, you create the entity by yourself as part of the rule.
Is this true ?
And since there is no a "create a node" action, only the "create an entity" - you must create an entity and not a node. True ?
Please try the following - one ruleset to create the entity/node, which return the new content, and second ruleset that gets the new entity/node and then sets the domain - and in this second ruleset you should add a condition "entity is a node".
I believe this might make it possible to do what you need.
Please try it out before I continue getting into it.
Regards,
Shushu
Comment #6
roeneman commentedHi Shushu, interesting suggestion, didn't think of that, but unfortunatly no success.
Please find attached the 2 rules, when executing the rule that adds the domain on an exisiting node, it does work. So rules should be OK. Any other suggestions? I'm more then happy to test!
Regards, Roen
Comment #7
shushu commentedI don't remember where, but in the rules about saving node/entity there is some autosave checkbox.
You must mark it so the node will be saved in the first rule.
Then, I believe the second rule will work properly.
Please look for it and let me know if it helps.
Comment #8
roeneman commentedHi, That is it!
Documenting:
When you want rules to create an entity of type node and add a domain, you should use two rules (for instance in a ruleset):
Rule 1. Actions:
* Create entity
* Save Entity (select force immediate save)
Rule 2. Condition:
* Entity is of type = Node (be sure to select this one and not the 'node type' of the node)
Action:
* Set domain to node = 'your domain'
@Shushu, many thanks for your fast reply and solution. You're module is an important piece of my puzzle, so your professional support is highly appreciated. I believe I can actually finish my project today now, while yesterday I was sure it would take me an extra couple of weeks. Thanks, and sorry to start this of as a bug-report, while in fact is was a support request.
Regards, Roen
Comment #9
shushu commentedGlad I could help :-)
Comment #10
mlima commentedHello. I understand this have been closed since a while and I'm trying to do exactly what you guys solved successfully with no luck.
Can you please attach the code for me to import?
Alternatively can you explain what you mean exactly with "When you want rules to create an entity of type node and add a domain, you should use two rules (for instance in a ruleset):"?
Do this mean 2 actual rules have to be created?
Please help!!! I spent the whole day trying to solve it and it's an important piece of the project I'm working on.
Thanks
M.
Comment #11
shushu commentedHi Marco,
Let's go the other way - since this is an old issue, please describe your requirement and what you have tried, and I will be happy to suggest a solution for your needs.
Please open it as another support request issue.
Regards,
Shushu