If you're working with the new SalesLogix 7.2 Web Client & the Application Architect then the place to be is the slxdeveloper.com forum for the SalesLogix 7.2 Web. It has some really great discussions going on. One of these great discussions is where an slxdeveloper.com member needs to make the phone numbers hyperlinks. A user can click the phone number to launch a browser window, passing the phone number, to initiate a phone call. Let's take a look.
The following steps will convert the phone fields on the ContactDetails quickform to hyperlinks. When clicked, a new browser window will be launched and the phone number passed in the URL.
- Open the ContactDetails quick form under the Contact entity
- Locate the phone control named phnWorkPhone and remove it.
- Add a Button to the form where the phone control was before. Set the ButtonType to Link. Open the DataBindings and map the WorkPhone property to the control's Caption property.
- Create a LoadAction for the form and select C# Snippet for the action. Make sure you set the action's OnRepaintEvent to True (this is important).
- In the C# code for the action, we will get a reference to the current Contact entity and create the URL for the phone link button using the contact's WorkPhone value. We'll use the button control's OnClientClick property to set the javascript code to open the URL in a new window. The code will look like the following:
Sage.Entity.Interfaces.IContact contact = this.BindingSource.Current as Sage.Entity.Interfaces.IContact;
if (contact != null)
{
buttonDial.OnClientClick = string.Format("window.open('http://mydeskphone/dial?number={0}');", contact.WorkPhone);
}
Easy and elegant. I completely love the new SalesLogix Web.