function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andreas WissmeyerAndreas Wissmeyer 

Is it possible to create a direct link to call, given the contact number?

Hello all,
context is a Lightning app based on a customized VF page over Salesforce1 on a IOS device.

I was able to create a link in order to send an email to a contact just clicking on it (see code extract below). I would like to do the same with a phone, like it happens in the built-in contact page in Salesforce1. Anyone knows how to do it? At the moment I have just a text field which I cannot modify, and using method apex:inlineEditSupport is not really a valid solution in my case.

Below my code:

<apex:repeat value="{!contacts}" var="cont_acc">
      <tr>
          <td>{!cont_acc.Name}</td>
          <td>
                  <apex:outputField value="{!cont_acc.Phone}">                           
                      <apex:inlineEditSupport event="onclick" rendered="true"/>
                 </apex:outputField>
          </td>
          <td>
                  <apex:outputLink value="mailto:{!cont_acc.Email}">{!cont_acc.Email}</apex:outputLink>
           </td>
      </tr>
</apex:repeat>


Thanks in advance for your help on this.

Cheers, A.

Best Answer chosen by Andreas Wissmeyer
Himanshu ParasharHimanshu Parashar
Hi Andreas,

You can use tel: attribute to get a link to call as shown below, make sure you are adding docType="html-5.0" attribute to your <apex:page prior to do that.
 
<apex:repeat value="{!contacts}" var="cont_acc">
      <tr>
          <td>{!cont_acc.Name}</td>
          <td>

<apex:outputLink value="tel:{!cont_acc.Phone}">{!cont_acc.Phone}</apex:outputLink>                 
          </td>
          <td>
                  <apex:outputLink value="mailto:{!cont_acc.Email}">{!cont_acc.Email}</apex:outputLink>
           </td>
      </tr>
</apex:repeat>


Thanks,
Himanshu
 

All Answers

Himanshu ParasharHimanshu Parashar
Hi Andreas,

You can use tel: attribute to get a link to call as shown below, make sure you are adding docType="html-5.0" attribute to your <apex:page prior to do that.
 
<apex:repeat value="{!contacts}" var="cont_acc">
      <tr>
          <td>{!cont_acc.Name}</td>
          <td>

<apex:outputLink value="tel:{!cont_acc.Phone}">{!cont_acc.Phone}</apex:outputLink>                 
          </td>
          <td>
                  <apex:outputLink value="mailto:{!cont_acc.Email}">{!cont_acc.Email}</apex:outputLink>
           </td>
      </tr>
</apex:repeat>


Thanks,
Himanshu
 
This was selected as the best answer
Andreas WissmeyerAndreas Wissmeyer

Hello Himanshu, thanks a lot. This was exactly what I needed! I also tested it with " " and "-" in the number, and these characters are automatically removed, while important characters like "+" are kept.

Cheers, Andi