Here, https://forum.espocrm.com/forum/feat...-phone-numbers yuri have mentioned a script that allows me to add more phone types while exporting, but I'm unable to find the path. Can anyone help me?
Need to find the path for adding more phone types while Exporting
Collapse
X
-
Tags: None
-
You may find it useful:
- First implement a solution with the ability to transfer data from phoneNumberData to a text field https://forum.espocrm.com/forum/gene...660#post111660.
- Then you can export data from this text field in the form of absolutely all phone numbers that have a contact, lead or account.
Last edited by victor; 10-29-2024, 11:11 AM. -
victor , this is fine. I'm getting a 'Syntax error: Attribute name contains not allowed characters,' but I can fix it. Is it not possible to implement this in the way yuri mentioned? I don’t want this field in the list view since it’s not useful for click-to-call functionality as it’s not a tel link; exporting is my main concern.Comment
-
I worked on the formula and fixed the syntax errors. However, I am facing one issue: emails are appearing as links, but phone numbers are not. Please review the attached screenshot. Is there any way I can achieve this?"
$phoneNumbersCount = array\length(phoneNumberData);
$phoneNumberData = json\encode(phoneNumberData);
$phoneNumbersArray = ''; // Initialize as an empty string
$i = 0;
while ($i < $phoneNumbersCount) {
$phoneNumber = json\retrieve($phoneNumberData, string\concatenate($i, '.phoneNumber'));
// $phoneNumberTel = string\concatenate($phoneNumber);
$phoneNumbersArray = string\concatenate($phoneNumbersArray, $phoneNumber, '\n');
$i = $i + 1;
}
cMyPhoneNumber = $phoneNumbersArray;
$emailAddressesCount = array\length(emailAddressData);
$emailAddressData = json\encode(emailAddressData);
$emailAddressesArray = ''; // Initialize as an empty string
$i = 0;
while ($i < $emailAddressesCount) {
$emailAddress = json\retrieve($emailAddressData, string\concatenate($i, '.emailAddress'));
$emailAddressesArray = string\concatenate($emailAddressesArray, $emailAddress, '\n');
$i = $i + 1;
}
cMyEmailAddress = $emailAddressesArray;
Last edited by Ashif Malayil; 10-29-2024, 05:26 AM.Comment
-
To make phone numbers appear as links and be able to be called, you need this line from the above post: $phoneNumberTel = string\concatenate('[', $phoneNumber, ']', '(tel:', $phoneNumber, ')');
We would also be grateful if you could point out what specific syntax errors you found in the provided formula script solution.
-
-
Still after exporting this, both columns are empty in the sheet.1 PhotoLast edited by Ashif Malayil; 10-29-2024, 06:43 AM.Comment
-
Hi Ashif Malayil,
I checked how the fields are displayed in different exported file types. Please review:
CSV export file:
XLSX export file:
Comment
-
Thank you, lazovic . It's working now while exporting to CSV.
- I was getting the error "Syntax error. Attribute name contains not allowed characters" while using the formula shared by Yuri.
- After adding the formula $phoneNumberTel = string\concatenate('[', $phoneNumber, ']', '(tel:', $phoneNumber, ')'); the phone number field is still in text format. Please find the attached screenshot for reference
1 PhotoLast edited by Ashif Malayil; 10-29-2024, 07:42 AM.Comment
-
Ashif Malayil,
Sometimes it happens that if you copy text from a forum, an extra character is added (in the formula script window in the EspoCRM instance, it looks like a red dot at the end). That's why you got the error initially.
Please use this formula script; I changed it to match the names of your custom fields:
Code:$phoneNumbersCount = array\length(phoneNumberData); $phoneNumberData = json\encode(phoneNumberData); $i = 0; while ($i < $phoneNumbersCount) { $phoneNumber = json\retrieve($phoneNumberData, string\concatenate($i, '.phoneNumber')); $phoneNumberTel = string\concatenate('[', $phoneNumber, ']', '(tel:', $phoneNumber, ')'); $phoneNumbersArray = array\push($phoneNumbersArray, $phoneNumberTel); $i = $i + 1; } cMyPhoneNumber = array\join($phoneNumbersArray, '\n'); $emailAddressesCount = array\length(emailAddressData); $emailAddressData = json\encode(emailAddressData); $i = 0; while ($i < $emailAddressesCount) { $emailAddress = json\retrieve($emailAddressData, string\concatenate($i, '.emailAddress')); $emailAddressesArray = array\push($emailAddressesArray, $emailAddress); $i = $i + 1; } cMyEmailAddress = array\join($emailAddressesArray, '\n');
Comment
-
lazovic It’s working perfectly. In List view and while Exporting.1 PhotoLast edited by Ashif Malayil; 10-29-2024, 09:53 AM.Comment
-
lazovic , are you aware of the process that yuri mentioned in this post: Importing Multiple Email Addresses and Phone Numbers? If it works, it would be an excellent feature to implement.
Last edited by Ashif Malayil; 10-30-2024, 09:20 AM.Comment
Comment