Verified phone is required by many clients for their business use case. Verified phone helps business to give their services to valid customers. Below are some reason where business are going with phone verification
- Better Service : If phone (mobile) is verified then we can send service messages on mobile. Instead of sending message on fake mobile number it will reach to correct person.
- Avoid Fake : Fake profile can be created by users. Phone verification will help us to take decision for deleting, deactivating or activating them.
- Easy Use: SMS/Message are preferred way for notification of any service update. So phone verification is required.
In Salesforce we can easily validate mobile/phone number using regular expression but system will not help in verification of phone number.
There are many API/products available for phone verification. Here are some API which can do phone verification
I am using Veriphone for verifying phone in this post but we can use any one based on license availability.
Account object is storing customer information. We need to verify object record’s phone number.
We can verify all account records in one go with batch processing or we can go manually one by one for phone verification. I am going with manual verification.
Step for this use case solution:
- Veriphone API integration
- Flow creation to call apex
- Add button on screen
- Testing solution
1. Veriphone API integration:
Before we use Veriphone API , we have to create a free account at here. Once you create and verify account. Go to setting page of your API dashboard and copy API key.
As we have API key now to call veriphone api. Let us create a basic apex class to call this API. We can use this API using GET/POST call. I have used GET method of this API to verify it. This API required only phone number with country code and API key.
API Url : https://api.veriphone.io/v2/verify?phone=mobile&key=apikey
Replace mobile and API key based on your setting and record page.
2. Flow Creation to call above Apex
We have to call above class method from flow to get verification done. So for doing this we need InvocableMethod which can be called from flow.
Let us create a controller class to call above phone service class.
Now we need to create a flow to call this method.
Flow Type : Screen Flow
Element used : Get, Update, Decision, Screen, Action and Assignment
- Create a variable recordId of text type to get current record id
- Use Get element to get account record based on above recordId. Return mobile/phone and PhoneVerified fields. Phone Verified field is custom boolean field to store status of verification.
- Add Action element and use above created action Verify Phone (PhoneVerificationController). Pass account record phone field to method. Add one variable to store boolean response from action call.
- Check response value using decision element. If returned value is true then assign true to Phone Verified field and update record using Update element.
- If response is false then simply show message that phone is not verified.
If you are able to do this step properly then clap for your self, if not then use flow metadata from here.
3. Add button on Page layout
We need button on account page layout so that we can verify phone. For this let us create a new action button and call above flow from that button.
After button creation add that button to page layout in Salesforce Mobile and Lightning Experience Actions section.