Hi, I have been using SuiteCRM for several years, have made various customisations and am quite adept at getting into studio. But, one area that I have not yet really been able to get my head around… and I am quite used to SQL and databases, is setting up relationships. Let me explain what I am trying to do.
I have a large Contacts / Clients HR form that is split into various sections, one for personal details, one for how they are associated to us and one for our interaction with that client.
I wish to separate the interaction section from the form into its own module. We can often have various interactions with the same client, hence a one to many relationship.
I have set up the module with the various fields that are required and then have created the relationship to that new module from the Contacts module. The new module appears as a sub-panel under the Contacts form, But, when I go and create a new sub-panel item it asks me who the contact is. It doesn’t recognise the fact that I am already in the contact and automatically assign that contact to the new sub-panel item. i.e. it asks for the name of the contact.
What have I missed? Is there a simple guide to setting up relationships anywhere?
I have done the “Repair Relationships”. That does not add anything extra. When I created the module, I used the Basic Module Template which adds “Name” as a required field. But that field is not a “Relate” field so does not allow you to Select from your contacts the current name of the contact. The only way you can seemingly get a Select field to appear is to add a “Relate” field to the Contacts Module. What I am saying is that there is no need to have a select field or the name field as I am already in the Contact module and it SuiteCRM should know that I am already in that contact. (I assume that in the backend dB there is an hidden ID that associates the new form with the contact but why am I having to select it in the form?
If you created the relationship between the two modules correctly, and I assume you did because you get the subpanel, then it really should be recognizing which contact it is under, and should connect the two records correctly.
if your supanel is not populating the Contact value for relate, while being in the Contact record, then this points to an issue with wrong relationship files. Did you add a relate field of CONTACT in your new module or a Relationship ?
OK Folks, I seem to have sorted things out… When you use the “Basic” template within the Module creator it adds a “Name” field that is a required field. This seems to be the key field. Without adding a relate field the sub-panel works just fine. The trick I have found is to rename this “Name” field to something useful from the data that I wish to enter. Having done that, so that it makes sense to me, the rest works. I just needed to understand the relationship of the “Name” field to the setup. I have now added the rest of the fields that I need in each record and it all is working.
So my question has now changed. What is a relate field? How is it normally used?