Ensuring data is standardized and well-maintained requires careful system design and consistent formatting to meet both current and future needs.

A common point of confusion is when people input phone numbers in different formats. Most systems treat phone numbers as text information which supports whatever a user wishes to input.

Users might end up typing in phone numbers like they do it in other systems they’re used to, and such habits can over time become a mess of inconsistent data formats. It is quite common to run into number separators that are combinations of dashes, dots, or spaces. To simplify working with phone numbers, we want to keep a very simple number-only format. We can do this with a low code processes in Creatio FreedomUI.


Here is an example of a record that has such a format. The phone number has a common format of 10-digit numbers separated by dashes.

example of numbers separated by dashes

We want to implement a process that will automatically execute in the background and watch for changes to the phone number. When the phone number changes, we want to try and intercept the value input by the user so we can reformat it according to our needs.

In this case we are working with Contacts, so at the Contact level, we will create a process that hooks directly to the object that maintains this data. The benefit of this is that it will fire off immediately when data is being processed, in real time. And unlike business processes that execute after data has been saved, this process allows real-time checking of the value that was supplied and then clean up before it actually gets saved to the database.

Step 1:

Configure the “Contact” object with an event that will notify us when a record is being saved. This event notification will be the trigger for our process and then it will process the information that’s being saved.

triggering process before record save

Step 2:

Next, create an “Event sub-process” element in the process which will contain the process logic that needs to be implemented.

event sub process

Once added, it will show up as an empty box with a message element that we will configure in the next step.

empty process

Step 3:

Configure the message element so it picks up the event we are interested in. In our case, “ContactSaving” is the message that will be sent based on the configuration in Step 1.

contact saving configuration

Step 4:

Now we configure the script with just a few lines of code. Click on the script element to add the code in the script editor.

configure script

Note that the phone number cleanup is happening in the second line of code. It gets the “formattedPhoneNumber” by using the Regex.Replace command and simply replaces any non-numeric characters with no value, effectively removing the non-numeric characters.

Here is the full code script for reference:

Don’t forget to save and publish these changes when done.

Step 5:

Now that everything is in place, the easy part is to test if it works. We are going to test inputting a mobile phone number in the format “AAA.BBB-CCCC”. Clearly this is not a good format for a phone number.

phone number test

Next hit the Save button, and we see that the phone number saved and refreshed on the screen to a clean number format.

Perfect! Now our phone numbers will be automatically cleaned up every time someone saves their contact record.

newly formatted phone number example
Posted in:

Looking for Creatio help?

We do training, customization, integration, and much more. Contact us today.