Opportunities - Account

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • ferradeira
    replied
    It worked, but like this:


    $i = 0;
    $accountEmailAddresses = list();

    while ($i < array\length(account.emailAddressData)) {
    $accountEmailAddressesItem = array\at(account.emailAddressData, $i);

    $accountEmailAddresses = array\push(
    $accountEmailAddresses,
    object\get($accountEmailAddressesItem, 'emailAddress')
    );

    $i = $i + 1;
    }

    cAccountEmail = array\join($accountEmailAddresses, ', ');

    Leave a comment:


  • victor
    replied
    Principal identical:

    Code:
    $i = 0;
    $accountEmailAdresses = list();
    
    while ($i < array\length(account.emailAddressData)) {
        $accountEmailAdresseItem = array\at(account.emailAddressData, $i);
        
        $accountEmailAdresses = array\push(
                            $accountEmailAdresses,
                            object\get($accountEmailAdresseItem, 'emailAddress')
        );
        
        $i = $i + 1;
    }
    
    cAccountEmail = array\join($accountEmailAdresses, ', ');
    I use cAccountEmail field. In your case it may be different.

    I advice you to reed documentation on the formula used in EspoCRM: https://docs.espocrm.com/administration/formula/.
    Last edited by victor; 06-02-2026, 02:30 PM.

    Leave a comment:


  • ferradeira
    replied
    Can I use another formula bellow this one? I need to do the same for the emails. Where can I get the variables?
    Thanks

    Leave a comment:


  • ferradeira
    replied
    Thank you, it worked

    Leave a comment:


  • victor
    replied
    In Administration > Entity Manager > Opportunity > Formula > Before Save Custom Script:

    Code:
    $i = 0;
    $accountPhoneNumbers = list();
    
    while ($i < array\length(account.phoneNumberData)) {
        $accountPhoneNumbersItem = array\at(account.phoneNumberData, $i);
        
        $accountPhoneNumbers = array\push(
                            $accountPhoneNumbers,
                            object\get($accountPhoneNumbersItem, 'phoneNumber')
        );
        
        $i = $i + 1;
    }
    
    cAccountPhone = array\join($accountPhoneNumbers, ', ');

    Leave a comment:


  • ferradeira
    replied
    If I have 3 phone numbers it only gets the first one. Is there a way to get all the phone numbers?

    Leave a comment:


  • ferradeira
    replied
    I just refresh the browser and the Recalculate Formula appeared
    thanks

    Leave a comment:


  • ferradeira
    replied
    I don't have The option Recalculate Formula .
    But it worked. Thanks

    Leave a comment:


  • victor
    replied
    Yes, it is possible. Here is an example for the phone field. For the rest, the principle is the same:

    1. In Administration > Entity Manager > Opportunity > Fields create Account Phone field (most likely, this field will be created with the prefix "c", as in screenshot 1).

    Click image for larger version

Name:	image.png
Views:	2
Size:	24.4 KB
ID:	126632

    2. In Administration > Entity Manager > Opportunity > Formula > Before Save Custom Script, create a formula like this:

    Code:
    cAccountPhone = account.phoneNumber;
    3. For new Opportunities it will work instantly, but for old ones you need to do the Recalculate Formula function.

    Click image for larger version

Name:	image.png
Views:	2
Size:	23.4 KB
ID:	126633

    Leave a comment:


  • ferradeira
    replied
    Can we create a text field and get that information into it with a formula from the Account?
    Maybe it's easier ?

    Leave a comment:


  • victor
    commented on 's reply
    Please show in screenshot where you want more data about the relayed account. If you mean that your Account name should display your phone number and email address, that won't work.
    You can create your own fields in Opportunity and use a formula to get the values ​from the Account.
    Last edited by victor; 06-01-2026, 03:35 PM.

  • ferradeira
    replied
    Maybe below the Account, Need to add more fields that would be auto-filled. Or any other idea?

    Leave a comment:


  • victor
    replied
    Specify where exactly you want to receive such data.

    Leave a comment:


  • ferradeira
    started a topic Opportunities - Account

    Opportunities - Account

    In Opportunities - Account, when I choose the account how can I also get, not only the account name but also the mobile and office phone and the email?
Working...