Same entity on one-to-many or many-to-many relationship

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 7bridges
    Junior Member
    • Jun 2017
    • 4

    Same entity on one-to-many or many-to-many relationship

    Hi,

    first of all thanks for EspoCRM.

    We created some relationships one-to-many and many-to-many. We noticed that one entity can have a self-reference which is something we would like to avoid.

    For instance:

    Relationship: Competitors (Account many-to-many Account)

    If we edit the Account "A", we can choose "A" itself as Competitor. How can we filter "A" out of the list of Competitors?

    If there is anything you need me to provide more, please feel free to ask.

    Thanks.


    Regards
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    As I see it, you need to develop it
    as example you can use relationship between account and contacts in opportunities

    client/modules/crm/src/views/opportunity/fields/contacts.js
    application/Espo/Modules/Crm/Resources/metadata/entityDefs/Opportunity.json (view of the field Contacts)

    Comment

    • 7bridges
      Junior Member
      • Jun 2017
      • 4

      #3
      Thank you, Tanya, I'll have a look at it.

      Comment

      • 7bridges
        Junior Member
        • Jun 2017
        • 4

        #4
        Hi Tanya,

        another question: will these customizations survive an upgrade of EspoCRM? We do keep backups, but just to be sure.


        Thank you

        Comment

        • tanya
          Senior Member
          • Jun 2014
          • 4308

          #5
          Hello
          If you do this in custom folder - yes

          Comment

          • 7bridges
            Junior Member
            • Jun 2017
            • 4

            #6
            Great, thank you very much.

            Comment

            • joy11
              Active Community Member
              • Jan 2017
              • 113

              #7
              7bridges Were you able to figure out how to exclude that Account type? I'm stuck on something similar where I'd like to only allow accounts that are set as vendors to be selected in another entity. I'm not sure how to write the js. I have other filters that will pull the contact associated with the account, similar to the example given. I'm just not sure how to write the js to look for the value in the linked entity and then allow selection.

              Comment

              Working...