Custom view : Mandatory to fetch every time ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Firyo
    Senior Member
    • Jun 2022
    • 134

    Custom view : Mandatory to fetch every time ?

    Hi there,

    I'm currently editing a custom view of a field named "reference" located in the entity "Ticket".
    In the custom view I check if my entity "Ticket" is linked to an other entity named "Distributor".

    If the ticket is linked to a distributor, the goal is to get the value of the field named "color" localed in the distributor.

    The problem is that I don't want to make X fetches by unique distributor (which is the current case now).

    Is there any way to avoid making an absurd amount of AJAX calls for this particular case ?

    King regards,
    Firyo.
  • yuri
    Member
    • Mar 2014
    • 8454

    #2
    Hi Firyo,

    If it's many-to-one or one-to-one you can use a foreign field get directly access the color. You can create it via Administration > Entity Manager.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Firyo
      Senior Member
      • Jun 2022
      • 134

      #3
      Hi Yuri,

      Where can I create the foreign field in the entity manager ?
      I tried in the relations or the field "color" itself but haven't found anything.

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1250

        #4
        If you have a relationship between the Ticket and distributor as (Many Tickets Belongs to Distributor) then you can just go to Administration > Entity Manager > Ticket > Fields and click on Add Field and choose (Foreign) then you will directed to a page where you can configure the new foreign field. Give it a name then in the Link option select Distributor and then on the field option Select Color.

        That will generate a field that has the color value on the Ticket if it is linked to a Distributor who has a color.

        read this https://docs.espocrm.com/administrat...ds/#foreign​
        Attached Files
        Rabii
        Web Dev

        Comment

        • Firyo
          Senior Member
          • Jun 2022
          • 134

          #5
          Hi rabii,

          Thanks for the help, It's all clear now.
          It's the first time I ever heard about this type of field (even if I started working with Espo since like a year).

          Comment

          Working...