Announcement

Collapse
No announcement yet.

Fetching existing Number (auto-increment) field value from one record to another

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fetching existing Number (auto-increment) field value from one record to another

    In Account module, I have a field called Client ID, so when i am creating a new record with the same phone number of the existing Account. I want to fetch the Client ID from the existing Account to this new record. How can i achieve this?

  • #2
    You may fetch the ID by relationship to a text field, but you will not be able to use it as the ID of the new record, as ID is unique (with quite a good reason).

    Comment


    • #3
      Playing with phone number can be difficult but it sound achievable with formula and find(record). Here is a small sample I use to auto assign my email Parent field to a Case.

      I link it by doing a search for the email reference.

      Code:
      $findrecord = record\findOne('Case', 'field_searchbyID', 'desc', 'field_searchbyID=', string\substring(subject, 0, 5)); // 'desc' is Descending, must have this field. Case is the entity, substring is what I'm trying to find, I see in the field subject, and I want the 5 digits. (writing these comment on top of my head, so consult the formula documentation: https://docs.espocrm.com/administration/formula/)
      
      ifThen(
          entity\isNew = true && fromAddress == 'email1@email.com' && $findrecord != null,
          //emailCategory = list($findrecord, parentType, 'Case', parentId = $findrecord);
          parentType = 'Case'; parentId = $findrecord
          );​

      Comment


      • #4
        The issue got fixed by the formula.

        Comment


        • #5
          esforim Can you please help me out on this issue,

          Comment

          Working...
          X