No announcement yet.

Entity Relationships

  • Filter
  • Time
  • Show
Clear All
new posts

  • Entity Relationships

    Hi - first post here.

    I have "studios" as entities.

    I have "performers" as entities. Here they have their real names and things like photo id, etc. This is who they really are.

    The performers can belong to many studios, each studio allocating an id and stage name (which may be shared or may be unique between studios).

    I'd like to select a studio and see all performers allocated.
    I'd like to select a performer and see all studios they belong to.

    How on earth do I set that up? I'm tying myself up in knots ...

    Any help gratefully received...

  • #2
    Hello David, Welcome. What you need is very easy to do in ESPO. You need to create Many To Many relationships with Performers and Studios entities.

    This is done in the entity manager under relationships. Once you have created the relationship in Studios, many to many to Performers, you will need to clear the cache in and rebuild in the admin panel. You will then need to go to the layout manager also in admin panel and select bottom panels.

    If you set the relationships up as many to many, you should now be able to simply drag the other entity into the bottom panels enabled side on the left.
    If for some reason you do not see the other entity yet, refresh your web-browser. You can do this for Performers first and when you open a Performers detail view, on the bottom panel it will show all of the Studios that that performer is assigned.

    You will want to repeat the procedure on the Studio layout view so that when you select a Studio, the performers will show up in the bottom panel of that Studio. For reference, the Bottom Panel in Espo is referred to as "The Relationship Panel" Good luck!!
    Last edited by Redwood; 08-13-2020, 03:42 AM.


    • #3
      Thank you, that was indeed easy! I'd worked most of it out except i had the wrong relationship type.

      Next, how do I actually assign an entity to another (ie a performer to a studio)? When I click the "+" in the relationship panel it brings up the create new form, so I'm guessing that relationship is created elsewhere. Still reading the docs like crazy ...

      Ideally, I'd like to assign the performer to the studio from the performer's detail page, if that's possible?

      (Absolutely loving the flexibility of ESPO, even if it is a little overwhelming at first)


      • #4
        Hello, mostly, when you are beginning with ESPOcrm it seems a bit difficult to understand and a newbee fears to destroy something by misconfiguration. ESPO is quite robust and even mistakes won`t destroy your former work. It is a lot of learning by doing.
        What Redwood wrote is all correct. Let me show you the configuration view of the relationship (I hope I did not make any mistake):

        Many to Many


        • shalmaxb
          shalmaxb commented
          Editing a comment
          Something that I remebered today: Think thouroughly about, how you name everything, because later you will only be able to edit the Label, nothing else. In my way to learn this, I had some relationships, that were very difficult to understand some time later. And if you already had worked with the entities and created formulas, you won`t like to change names, bacause you will have to check all these things again.
          Every name and middle table will have equally named tables in the database.

      • #5
        Thanks shalmaxb for the effort, I also will share here the formal documentation of relationships in espocrm:

        If you have suggestions or improvements for the documentations you can contribute to this repository:

        EspoCRM Documentation. Contribute to espocrm/documentation development by creating an account on GitHub.

        CEO of Eblasoft
        EspoCRM Expert since 2014
        Full Stack Web Developer since 2008
        Creator of Numerous Successful Extensions & Projects​


        • #6
          @davidwylie, first you need records in both the performers and studios. If you configured your relationship correctly (I guess you did), don`t forget to configure the layout of both your entities as well. The relationships appear like fileds in the layout manager. To put them into your detail view, you have to: open the detail view of the entity -> on the left open bottom panels -> you will see the fields already connected with the bottom panel, drag the relationship field from the right field list into it.
          Now save your layout manager, rebuild and not to miss anything, clear your browser cache and restart your ESPO. Then you may go to one of the performers and assign a studio. You should see assigned records in both entities, the performer will appear in studios and the studio in the respective performer record. Be aware, that ESPO by default only links the name field, to link more fields of the relationship you need to code or get the extension by elbasoft.

          Whenever you from now on create a new performer you can assign a studio to him/her and this will appear in both of your entities.


          • #7
            Thank you everyone, it appears to be working perfectly.

            The bit I was missing was how to assign a performer to a studio, but I worked it out. For future reference, you click the 3-dotted button in the right corner of the relationship panel (not the "+") and choose "select" from the menu that appears.


            • #8
              (question deleted - made no sense)
              Last edited by davidwylie; 08-12-2020, 09:51 AM. Reason: Was nonsense - just noise :)