Workflow and Formula fun

Workflow to Copy Phone field Values as Number

I was recently working on an integration with a Computer Telephony Integration (CTI) piece of Software.

The customer wanted a flow where a customer would call in, enter a series of digits (in this case their telephone number) and then when the call was answered Salesforce would display the matching record to the agent answering the call.

Formula checks that the Routing Number field is blank or whether the Phone number has changed

The Problem

The CTI solution did this out of the box if the customer's calling number matched the "Phone" field on the Account record, but our challenge was that if the customer called from an unknown or different number to the one on the account then they should be able to enter a number on a keypad and manually match to the correct record that way.

When the customer was entering the phone number manually it was coming through into Salesforce as a Number/Integer field.

However, this no longer matched the formatting of the original Phone type field so we had to find a solution to have a version of the Phone number saved as a Number on the Account page.


To accomplish this a simple Workflow was set up to Copy the Value of the Account "Phone" field, convert it to a Number and copy the value into a new field called "Routing Number"

The Workflow criteria was set to "Evaluate the rule when a record is created, and every time it's edited". Once initiated the Workflow contained a simple formula:

OR(ISCHANGED(Phone), ISBLANK(Routing_Number_c))

If the criteria matched, the Workflow would set off a field update with the formula:


The field update uses VALUE(NAME OF FIELD) to copy the value of phone and convert it into a number format.

Extending functionality to Opportunities

Everything worked great on the Account matching Workflow that we put in and a short while after the customer wanted to extend the use case to include Opportunities.

The logic requested was that if an Opportunity was in an "Open" or "Processing" state then the contact's telephone should appear on the record so that it could be found by the CTI software and displayed to the agent when answering the call.

My first thought on doing this was that another workflow might be needed, but it was actually much simpler as we had already created a Number-formatted version of the Phone field on the Account.

All I had to do for this request was add a Formula field which would only populate the Phone Number field if the Opportunity record matched the stage of "Open" or "Processing".

Here's the Formula field:
Another formula field on Opportunity to match same behaviour
This is the actual Formula:
  ISPICKVAL(Opportunity_Status__c, "Open"),
  ISPICKVAL(Opportunity_Status__c, "Processing")

Hope these formulas are useful to you.