How to define a field as a linkes field to a record of an entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ctheuring
    Senior Member
    • Oct 2022
    • 144

    #1

    How to define a field as a linkes field to a record of an entity

    May be I've some planks in front of my head ...
    I've an entity Bounces type Base and an entity Personen
    In the Entity Bounces there is a field id and a field PersonenID - varchar 24 - (as result from an import)-
    I've only the base-relations. I can't use a normal relation between Bounce and Personen - this wood be between Bounce.id and Personen.BounceId.
    How to set a link for the field to the record in the entity Personen where the Persionen.id = Bounce.PersonenId?
    Alternative:
    How to set a relation from Bounce to Personen with the link not between the ID of Bounce and the ID of the Personen-record - it must be a link between the field Bounce.PersonenId and Personen.id? This relation must be a 1to1 right.

    Christoph
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1700

    #2
    This is very difficult to understand, what you want to achieve. It does not matter if you have base or base plus entity, relationships are possible the same in either one.
    1:1 appeas to be correct, because any person only has one possible Id. So you should create that relationship and map the person I from one entity to the other by formula.
    It is a bit guessing, due to the confuse explanation.

    Comment

    • ctheuring
      Senior Member
      • Oct 2022
      • 144

      #3
      Thanks for reply.
      I made a 1:1 right relationship from Bounces to Personen. This linked the id from Bounces to the Personen.id. -> bullshit for me.
      So I copied all personIds from the field PersonenId of Bounces to the field id from Bounces - replace the Bounces id with the contend of the field PersonenId. Now there is a new link field Person to Personen ... but the field is EMPTY instead of showing the field(s) name for Personen.
      I hope you can now better understand my problem.
      Christoph

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1700

        #4
        I still try to understand, so here is my guessing:

        1. You have an imported value PersonenID -> This Id will not be the id of the id in the new entity, to where you imported it. If this entity is named personen, after importing records from elsewhere, every record gets a new id, created automatically from espoCRM.
        2. You want to link the imported personen to specific records in the entity Bounces, right?
        3. Then you copied the imported id to replace the id of bounces?
        4. So you must have the imported id value also in a field in Bounces to be able to fererence it. Then you have a field personen Id, which is also present in bounces an a fiel personen name
        5. Then you need a formula in Bounces like

        Code:
        ifThen(
        personenId == personen.personenId,
        name = personen.name
        );
        This formula means: If the id of the person is equal to the personenId in personen, get the name of that person to display in bounces.

        I still am guessing a bit and the field names maybe different, but what is the most important, don`t try to mess with the id, which espoCRM sets.

        Comment

        • ctheuring
          Senior Member
          • Oct 2022
          • 144

          #5
          Hallo shalmaxb,
          my basis entity is Personen (people) and in the entity Bouces I imported a bouce-list, created by cleverReach, include a field personenId.
          In the entity Bounces, I appended some fields, which are filled by the contend of formular of Bounces. This is to match the fields of the imported bounce-records with the basis-records of my entity Personen - i.e. in the details-view.
          Here is the content of my bounce-formular:
          --------------begin of formular------------
          $fid = record\attribute('Personen', personenId, 'firmenId');
          personAnrede = record\attribute('Personen', personenId, 'salutationName');
          personTitel = record\attribute('Personen', personenId, 'titel');
          personVorname = record\attribute('Personen', personenId, 'firstName');
          personNachname = record\attribute('Personen', personenId, 'lastName');
          personStatus = record\attribute('Personen', personenId, 'status');
          personAusgeschieden = record\attribute('Personen', personenId, 'ausgeschieden');
          personEmail = record\attribute('Personen', personenId, 'emailAddress');
          personkeinemail = record\attribute('Personen', personenId, 'keinemail');
          firmenId = $fid;
          firmenStatus = record\attribute('Firmen', $fid, 'status');
          firmenEmail = record\attribute('Firmen', $fid, 'emailAddress');
          firmenkeinemail = record\attribute('Firmen', $fid, 'keinemail');
          name = string\trim(string\concatenate(anrede, ' ', titel, ' ', nachname, ', ', vorname));
          ----------end of formula----------------
          So I get a quick overview of the bounce-records.
          Now I want to get a link in the list-view or in the details-view to switch to the responded record of the entity Personen.
          Ok - it's not a good idea to replace the system-created bounce id with other ids, but in this case it's not relevant.
          Did you understand a little bit better what is my aim?
          Christoph

          Comment

          • shalmaxb
            Senior Member
            • Mar 2015
            • 1700

            #6
            I admit, I still do not get it completely. Did you establish a relationship between person and bounces entities?
            As I understand you want to display in your bounces entity field values from person and account (firm).
            In person you seem to have a field firmId (account Id) as well.
            An in bounces you want to display the person record belonging to that bounce, right?

            Do you use for the firm the account entity of espoCRM or is the firmId just a value in the person entity, not pulled from account? Is "Firmen" an entity (account)?

            If so, you will need a 1:1 relationship from person to bounce (means: one person can have one bounce record).

            Then you will have a link field created, where you can choose the person in the bounce entity an the bounce in the person entity.

            In your formula you get the values not by record\attribute but by the linked fields, which look like personAnrede = person.salutationName

            Comment

            Working...