External link connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tothewine
    Active Community Member
    • Jan 2018
    • 384

    External link connection

    Click image for larger version

Name:	image.png
Views:	33
Size:	246.6 KB
ID:	114607

    II wanted to link field 1 of a linked entity as field 2 of a record I imported.
    How can I do this.
    I installed version 9.0.2 without extensions​
  • tothewine
    Active Community Member
    • Jan 2018
    • 384

    #2
    I tried this formula

    -----
    capRecord = record\findOne('CAP', 'name=', addressPostalCode);
    ifThen(
    not(string\isEmpty(capRecord)),
    cap = record\attribute(capRecord, 'id')
    );
    -----


    but the log gives me this error

    [2025-01-29 18:11:55] CRITICAL: (0) Before-save formula script failed. Could not handle 'order' for 'CAP'. :: .../application/Espo/ORM/QueryComposer/BaseQueryComposer.php(2240)

    Comment

    • lazovic
      Super Moderator
      • Jan 2022
      • 851

      #3
      Hi tothewine,

      Your formula script is incorrect overall. Something like this might work (I'm not sure because I don't know the exact names of your fields and entities):
      Code:
      $capRecordId = record\findOne('CAP', null, null, 'name=', addressPostalCode);
      
      if ($capRecordId) {
          cAPId = $capRecordId
      }

      Comment

      • tothewine
        Active Community Member
        • Jan 2018
        • 384

        #4
        Does not work

        the fields to connect are
        of the CAP entity "name"
        of the Prospect entity "cap = addressPostalCode"
        the layout is of the Prospect entity

        Comment

        • lazovic
          Super Moderator
          • Jan 2022
          • 851

          #5
          tothewine,

          Please note that this solution will only work if you update the Prospect record or recalculate the formula in List View of Prospect records.

          If this does not help, please make the following screenshots:
          • Administration > Entity Manager > CAP
          • Administration > Entity Manager > Prospect > Fields > CAP
          • Administration > Entity Manager > Prospect > Fields > Address Postal Code

          Comment

          • tothewine
            Active Community Member
            • Jan 2018
            • 384

            #6
            Click image for larger version

Name:	image.png
Views:	0
Size:	29.3 KB
ID:	114639
            Click image for larger version

Name:	image.png
Views:	0
Size:	43.4 KB
ID:	114640

            Click image for larger version

Name:	image.png
Views:	0
Size:	40.3 KB
ID:	114641


            Comment

            • lazovic
              Super Moderator
              • Jan 2022
              • 851

              #7
              tothewine,

              Many thanks.

              Please try to use the following formula script for the Prospect entity:
              Code:
              $capRecordId = record\findOne('CAP', null, null, 'name=', addressPostalCode);
              
              if ($capRecordId) {
                  capId = $capRecordId
              }

              Comment

              • tothewine
                Active Community Member
                • Jan 2018
                • 384

                #8
                thanks, it's correct

                Comment

                • tothewine
                  Active Community Member
                  • Jan 2018
                  • 384

                  #9
                  I tried to use the same formula to connect the Appuntamento entity to the CAP entity, but it doesn't work

                  // Aggiorna da Prospect

                  indirizzoStreet = prospect.addressStreet;
                  indirizzoCity = prospect.addressCity;
                  indirizzoCountry = prospect.addressCountry;
                  indirizzoPostalCode = prospect.addressPostalCode;
                  indirizzoState = prospect.addressState;

                  // Aggiorna CAP

                  $capRecordId = record\findOne('CAP', null, null, 'name=', indirizzoPostalCode);

                  ifThen(
                  $capRecordId,
                  capId = $capRecordId
                  );

                  Comment

                  Working...