Custom Function to Format Phone / Mobile numbers in Australian Standard format

Custom Function to Format Phone / Mobile numbers in Australian Standard format

So I got sick of phone numbers being formatted incorrectly and Zoho not doing anything to standardise phone numbers to meet E.164 formats. So I went and coded my own function to fix this.
And figured I'd share with the community

This is specifically for Australian numbers. 

The CF will take all mobile, local landline, 1800 & 1300 numbers and format them into the format we are used to in Australia.
It will also add the country code +61 to the prefix so you can call directly from the CRM.

It works with all 10 digit numbers (0400 000 000 or 03 9000 0000)
And with all 9 digit numbers (400 000 000 or 3 9000 0000)
IE works with both the starting 0 or without the starting 0 (ie 03 9000 1111 or 3 9000 1111)


The numbers will be formatted as below


All mobile numbers    0400111222 --> +61 400 111 222
                                       400111222 --> +61 400 111 222
All local numbers        0390001111 --> +61 3 9000 1111
                                       390001111 --> +61 3 9000 1111
1800 numbers            
1800111222 --> +61 1800 111 222
1300 numbers            1300111222 --> +61 1300 111 222

For the local numbers it will work with all states area codes (02, 03, 07, 08)

Anything that isn't the above will be ignored and stay the way it was. IE 131122 will stay like that
As will any numbers that aren't 9 or 10 digits long. (ie +61400111222 wont be formatted with spaces)

**NB I may do a V2 to format numbers that are +61 already but not planning that for a while.

This function is specifically for the Leads module.
It is Phone/Mobile Field agnostic. In that it will take whatever value is in the Phone Field, format it return it to the Phone Field. and what ever is in the Mobile Field, format and return it to Mobile Field.

I did this specifically as we use Phone to be the contacts Primary contact number and Mobile to be their Secondary contact Number.

It should be pretty easy to adapt to Contacts Module or any other module. You only need to change line 1 & 211.


Setting up with Workflow and Triggering the Function:
This applies for CRM
  1. Go to Setup --> Automation --> Workflow Rules --> Create Rule --> Under Module, select Leads --> Give a Rule name and Description (ie Format Phone Numbers Australia) --> Next
  2. When = Select "On a Record action" --> "Create or Edit" --> Next
  3. Condition = In Conditions, choose "All Leads" --> Next.
  4. Instant Actions --> Function --> New Function --> Write your own --> Add a Function name (ie Format_Phone_Numbers_Au), Display Name (ie Format Phone Numbers Australia), Description --> Create
  5. Copy paste the code from below and proceed to save the code.
  6. "Edit the Arguments" --> Key is id, in Param Value type # and choose your fields (ie Leads and Lead Id) the end result should read id = Leads - Lead Id --> Save
  7. Save the Function 
  8. Save the Workflow.


NOTE: there is probably a better more efficient way of achieving this.
So if anyone know a better way to code the above I'd love to hear.

EDIT: I had to upload the code separately due to restrictions in the post lengths.

EDIT 2: now updated to work with brackets (03) 9000 1111 and hyphens 0400-000-000

EDIT 3: updated to work with the country code already added but no + ie 61400111222  


The number formatting will work with the following

All mobile numbers    --> +61 400 111 222
  1. 0400 111 222
  2. 400111222
  3. 0400-111-222
  4. 61400111222
All local numbers  --> +61 3 9000 1111
(works with 02, 03, 07, 08) 
  1. 0390001111                  
  2. 390001111
  3. (03) 9000 1111
  4. (03) 9000-1111
1800 numbers  --> +61 1800 111 222
  1. 1800111222
  2. 1800 111 222
1300 numbers  --> +61 1300 111 222
  1. 1300111222 
  2. 1300 111 222 

    Zoho Campaigns Resources


      • Desk Community Learning Series


      • Digest


      • Functions


      • Meetups


      • Kbase


      • Resources


      • Glossary


      • Desk Marketplace


      • MVP Corner


      • Word of the Day


      • Ask the Experts


        Zoho CRM Plus Resources

          Zoho Books Resources


            Zoho Subscriptions Resources

              Zoho Projects Resources


                Zoho Sprints Resources


                  Zoho Orchestly Resources


                    Zoho Creator Resources


                      Zoho WorkDrive Resources



                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ






                              ご検討中の方

                                • Recent Topics

                                • Add Serial Number Zoho CRM Subform

                                  Hi Guys, I need to add Serial Number in Zoho CRM Subform table. In addition of an row we can easily create in Zoho Creator. But in Zoho CRM how we can do that? Any suggestion would be very helpful.
                                • Suddenly Can't Send Outgoing Mail (SMTP)

                                  Suddenly I can't send mail anymore from my phone mail app. I have Zoho OneAuth MFA set up and an app specific password set up. It has been working correctly for a while. Has something changed with your servers or setup for SMTP? No settings have changed
                                • Sent emails not going and showing "Processing"

                                  Hello Team, Could you please assist with sent emails showing "processing" and not actually going through? Many thanks and regards, Cycology
                                • Shared Mailbox - Mark as read for all users

                                  Hi all, Maybe someone can help me out. At the moment we have a shared mailbox without streams. When a users reads an mail or marks it as read other users will not see this. How can we resolve this? We now archive the mails when read and followed up. However
                                • Domain verification is in progress... (How long do I need to wait?)

                                  Trying to setup my first email domain by connecting with GoDaddy. Have been here for quite some time and the screen is not changing. How long should this take?Send DataSend Data
                                • Multiple workflows based on stage?

                                  I am trying to have multiple things happen when I close a deal. First, I would like to send a thank you/coupon email to all deals that are closed. Second, I would like to create connected records in a separate pipeline for certain projects that qualify.
                                • discount on total amount

                                  i want to add discount on total value of my purchase order instead of applying line by line.my customer will not accept the discount on line by line.
                                • Important update in Zoho Forms: Enhancements for improved email deliverability

                                  Hello, form builders! We would like to inform you about some changes we're making in Zoho Forms to ensure the deliverability of your outbound emails. Changes to Gmail policies Gmail has updated its DMARC policy which quarantines emails sent with gmail.com
                                • payment voucher, receipt printing feature

                                  Why dont ZOHO add the voucher printing feature in zoho book with authorised signatory and receiver's signature
                                • Inventory asset or cost of goods sold ?

                                  We can only choose inventory asset for items but lots of bills for items are posted with cost of goods sold - is this all balanced correctly or should it be entered differently ?
                                • Stock reservation in zoho for upcoming delivery

                                  Hi, Is there any option available in zoho for reserve item for a upcoming delivery. So that we can avoid the item should duplicated on another order. Means needs to deduct the item from zoho before making invoice.
                                • Banking: Transfer from another account without base currency

                                  Scenario: A banking line item shall be categorised as an "internal transfer" from another bank account. This is a USD to EUR transfer. Our base currency is CHF. What we tried: Category: "Transfer from another account" From: Our USD account To: Our EUR
                                • How to search records in integration task in creator?

                                  How to search using integration task in creator searchString = {"zcrm_account_id:4050082000001001499"}; contactData = zoho.books.getRecords("Contacts","xxxxxx",searchString); I get an error that third argument needs to be string, I tried to convert it
                                • Show my cost or profit while creating estimate

                                  Hi, While creating estimate it becomes very important to know exact profit or purchased price of the products at one side just for our reference so we can decide whether we can offer better disc or not .
                                • Outgoing emails to btinternet blocked.

                                  ERROR_CODE :421, ERROR_CODE :Too many messages (1.5.6.1) from 74.201.84.163I have been having problems sending to btinternet.com and btopenworld.com for the past week.  First 'email delayed' message, and then 'delivery failed', as above. Looks as though someone is spamming from the ZOHO email server 'sender163-mail.zoho.com' Surely this is abuse of your system, and you should be able to trace who it is (if it is a registered user of Zoho mail?) and block their account. An email system is really no
                                • single user access to the CRM suits

                                  I am currently using Zoho CRM Plus, where the pricing for a single user is ₹3,500 INR, and it includes access to multiple applications. However, I would like to add an additional user but restrict their access to only two specific applications within
                                • Mixed order: stock item and business purchase

                                  Hi, I'm just getting started with Inventory, and I haven't been able to find an answer to this. I am a small service business, and am just starting to sell products (in very low numbers). From my vendor, I purchase both items that I will on-sell, which
                                • Facebook Professional Account

                                  Zoho social says there is nothing to be added when I try to add my Facebook and Instagram accounts. Both are Professional profiles. How do I go about adding them? They are not Pages or Groups, they are simply Professional accounts.
                                • This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details

                                  Hello, Just signed up to ZOHO on a friend's recommendation. Got the TXT part (verified my domain), but whenever I try to add ANY user, I get the error: This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details I have emailed as well and writing here as well because when I searched, I saw many people faced the same issue and instead of email, they got a faster response here. My domain is: raisingreaderspk . com Hope this can be resolved.  Thank you
                                • How do you apply field validation to a date field?

                                  We are using Sign for remote e-signature of liability waivers. The signer must enter a date of birth, and if they are a minor their legal guardian must sign for them. However we have had numerous problems with signers returning an invalid date of birth
                                • Zoho Forms Submission URL

                                  Hi Zoho, It would be great to have a URL which can take us to specific form entries. For example: https://forms.zoho.eu/ACCOUNTNAME/report/FORMNAME/records/UNIQUE-REF I currently have a use case where I want to use Zoho Flow to create a module entry in
                                • How to disable clone record for a user?

                                  Hi, I'd like to disable clone records for some of my users in zoho crm. How can I go about doing that? Regards, CRM
                                • How to provide recommended KB articles in the welcome message

                                  I'm new to Zoho and am looking to replicate something I did for a previous employer. I want all newly created tickets to receive an automated welcome message that includes a few recommended articles from our knowledge base. Ideally there would be a way
                                • Dynamic integration of ZOHO CRM Data into ZOHO SHOW

                                  Hello, We are making offering with good design on ZOHO Show. A lot of data in those offerings are filled with Data present in ZOHO CRM (Account name, Name of the deal, Amount of the deal...etc). Thus could we push (in API ?) specific data from those fields
                                • Building a form with Categories and multiple sub-categories

                                  Hello, I am completely new to Zoho and the Deluge programming language. I would like to build an easy way to lookup a set of previous orders from my order tracking sheet. What I have done so far is import my Excel order list into Zoho so it shows all
                                • Zoho IP blocked by SpamCop 136.143.188.16

                                  Hello, I am unble to send any single email during the whole time due to the Zoho IP 136.143.188.16 being blolced by SpamCop.net Please help on this. RROR CODE :550 - spamcop.mimecast.org Blocked - see https://www.spamcop.net/bl.shtml?136.143.188.16. -
                                • Can't sign in to Zoho using Google account

                                  Just checking if anyone else has an issue signing into Zoho with a Google account at the moment? (Have tried Zoho Books in the app on mobile and Chrome and Firefox on Windows 10 - doesn't work for the forums either). Error message appears as attache
                                • unable to send message email outgoing blocked 554.5.1.8

                                  Hi good day to you, After migrating to a new hosting, I cannot send outgoing email, with an error message as below : unable to send message email outgoing blocked 554.5.1.8 Please kindly unblock my account, as I am in a rush to use it to work & communicate
                                • Zoho CRM - COQL query failing with no reason

                                  Hi I'm trying to execute a COQL query but it's returning an error. Unfortunately I cannot understand where I'm wrong The query is the following;: URL: POST https://www.zohoapis.com/crm/v2.1/coql Body: { "select_query": "select id,Adjustment,Billing_City,Billing_Code,Billing_State,Billing_Street,Buyer_PO_Number,Delivery_Date,Delivery_Method,Due_Date,Grand_Total,Invoice_
                                • SMTP Authentication error with django backend

                                  Hello I have e zoho mail id info@mindbrewers.in But when i use it for smtp it gives 535 authentication error in django website . EMAIL_USE_SSL = False EMAIL_USE_TLS = True EMAIL_HOST = "smtp.zoho.com" EMAIL_PORT = 587 EMAIL_HOST_USER = "info@mindbrewers.in"
                                • Separate Triggers and Enhanced Information for Zoho One Departments and Groups in Zoho Flow

                                  Dear Zoho Flow Team, I hope this message finds you well. Currently, there seems to be a mix-up between zoho one departments and groups in Zoho Flow, which causes some challenges in handling triggers effectively. For instance, when using the "User added
                                • Zoho Mail Search Engine Sucks

                                  Hello There! I really like all the features of Zoho Mail and I believe is way better than Gmail except for the Search Function. I believe Zoho Mail has a very poor search function, if you misspelled a word in the search box, Zoho Mail won't display any
                                • No recibo correo en en mi bandeja de entrada

                                  Hola, no puedo recibir correos en mi bandeja, tengo una pagina web y puse el correo en un formulario y cuando meto los datos y los envio no me llegan , pero si pongo otra ya sea gmail, outlook si los recibo, tiene que ver con mis dns?
                                • The sending IP (136.143.188.15) is listed on spamrl.com as a source of spam.

                                  Hi, it just two day when i am using zoho mail for my business domain, today i was sending email and found that message "The sending IP (136.143.188.15) is listed on https://spamrl.com as a source of spam" I hope to know how this will affect the delivery
                                • desbloquear cuenta

                                  Buenos dias  Cordial saludo Tengo una cuenta libre en zoho mail asociado a un dominio, pero uno de los usuarios se bloquea el correo porque dice que ha excedido el límite de correo, por favor podrian desbloquearla y como hago para que esta persona debe enviar sus correos sin ningun probleama. Gracias de antemano
                                • Zoho SMTP IP Addresses

                                  We are using Zoho Mail for a domain and need to whitelist some STMP IP from your service for a redirection. You can provide IP address list for Zohomail SMTP servers?
                                • no me llegan los correos a Zoho mail

                                  No puedo recibir correos pero sí enviarlos, ya hice la modificación de MX y la verificación de teléfonos, qué es lo que ocurre? gracias
                                • Emails being duplicated in sent items folder

                                  Since this morning, emails I send are appearing in my sent items twice (it wasn't happening before this morning) This appears to be a bug with zoho mail ... I can't see any other reason why they would appear twice.
                                • Restrict SalesIQ Account Notifications to Admins

                                  Dear Zoho SalesIQ Team, We appreciate the continuous improvements in SalesIQ. However, we have noticed that all users, including employees who do not have admin privileges, receive certain account-related notifications—such as the recent splash screen
                                • Email client fails to connect to IMAP & POP EU Servers for ALL users

                                  For the last couple of days, all users on my account are failing to connect to the Zoho EU mails servers. This is using mobile app on various phones & desktop mail clients on different computers. Everything works fine when using webmail & email is still
                                • Next Page