I have two modules “contacts” and “channels”. they have many-to-many relationship type.
I want that when I created a record (“channels”) in “channels module” it will automatically filled in the submodule in “contacts module”.
example so that you better understand what I want: right now i can create anything in “channels module” and go to “contact module” go to “chanels” subpanel and select “anything” but I want this to happen automatically.
Any suggestions on how I can do this? unfortunately I could not find something similar on this forum
I don’t completely understand what you mean… but have you tried a Workflow?
You either want an action to create a new record, or an action to create a new relationship.
here is my "contacts "module, and its subpanel with “channels” module
here is my “channels” module (the same as contact subpanel)
I want to create a channel and so that I can choose when creating which contact this channel belongs to (so that it automatically displays in “contact” subpanel of the contact I selected in textfield(relate type))
I hope now I could explain
Your second screenshot, the area you marked in red is not a subpanel. That is a relate field. The subpanels are the ones below.
after_save Workflow, see if you can catch the even of creating the record on one side, and then creating the relationship to the other (the equivalent of “selecting” a related record from the UI).
But how do you know which one to select?
could you provide an instruction or link? I do not quite understand what exactly needs to be done
maybe the question will sound more correct
See the first screenshot. This is the contact module and its sub-panels, the area marked in red is the channel contact (this is the same module as in the second screenshot). I can press the select button, and the option to select previously created entries will open in a pop-up window.
Now I have to do this - create a channel contact in the channel module, then go to the contacts module and go to the subpanel and find the “channel contact” -> and select the relationship that I need.
Can I make it so that when I create a channel in the channel module, I can automate this? A channel has been created in the channel module, the contact to which it is connected is indicated, and so that it is automatically selected in the subpanel of the contact module (as in the first screenshot)
I think you might have your relationships messed up. A relate field creates a certain kind of relationship; then the many-to-many creates another one.
If you were using only one relationship I think things would appear correctly.
Please check your Relationships area in Studio (as seen from both sides) and chose between that OR the Relate field you seem to have; but don’t use both.
Thanks for your reply.
Your advice works great.
But I need to add several channels to one contact. (According to your method, each new channel replaces the previous one (takes its place))
I would like to do this: using a text field (for example, Relate)
(or as my second screenshot. For example, any of the text boxes with the name “Contacts” or “Contacts”),
select a contact and add it to the subpanel (for example,like how it works in many ti many relationship)
Any tips on how I can do this?
So, lose the Relate field, use only a single many-to-many relationship.
In the views, make sure you have subpanels on both sides. Usually Studio creates them for you, but I am not sure if it creates them on both sides.
You are right, if I create many-to-many relationships, then I have subpanels on both sides, and I can use it well.
But my question is: can I use a text field on one side (Chanel module) to use it and not use a subpanel, while this text field should perform similar functions of a subpanel ?
That would require custom coding, it can’t be done through Studio…
I know. This is why I created a topic on the forum in the hope that someone was in a similar situation.
I hope for your any tips on where in the code and how I can change it.
Solution: use one-to-many relationship ,before that I did not use it correctly