Help creating a M:M link not based off Id

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kyle
    Senior Member
    • May 2020
    • 143

    Help creating a M:M link not based off Id

    Hi,

    I am trying to build a database for phone cards and I am having trouble getting the UI to work the way I would like. I think there should be a way to configure a link to do what I need but I can not work out how to do it. Any help would be appreciated.

    I have attached some images to help show what I am trying to do.

    Data model:

    A Phone Card Set can have 1 or More Phone Cards





    I have tried to create a new link from Phone Card to Phone Card using Phone Card Set as the intersection table but this has not worked.

  • eymen-elkum
    Active Community Member
    • Nov 2014
    • 472

    #2
    Hi Kyle,

    You need to define new link to PhoneCard manually and give it custom view, I think this is important question and can help many clients.

    Got to entityDefs > PhoneCard. json > "links"

    Add this link def entry:

    "phoneCards": { "type": "hasMany", "foreign": "anything", "entity": "PhoneCard"}

    You dont need "foreign", but I am not tested if espo will raise error if not presented.

    Go to clientDefs > PhoneCard. json > "relationships"

    Add This entry:

    "relationshipPanels": {
    "phoneCards": { "view": "custom:views/card/record/panels/cards" }
    }

    In the custom view you need to override the collection.url
    CEO of Eblasoft
    EspoCRM Expert since 2014
    Full Stack Web Developer since 2008
    Creator of Numerous Successful Extensions & Projects​

    Comment

    • Kyle
      Senior Member
      • May 2020
      • 143

      #3
      Thanks Eymen,
      I have been able to make this work (a few UI bugs that I am still working though but mainly up and going).
      I think it would be great if link definitions could be updated to use id's from other links rather than just id as a source field.

      Comment

      Working...