Community
Showing results for 
Search instead for 
Do you mean 
Reply

Reading country codes for phone fields

New Member
Posts: 2
Country: United_Kingdom

Reading country codes for phone fields

Hi,

 

I bumped into an issue when attempting to parse international phones using Act! SDK.

 

Here is a situation: a German customer / contact is assigned a "home phone" number "123 456 7890". Germany's country code +49 is applied through the formatting - the standard mini-box that shows up when we click on the ellipsis nearby "..." (picture attached).

 

 

 

 

However, whenever I read the contact's "home phone" value through Act! SDK, all I see is 123 456 7890. My goal is to get the full phone value somehow so that it would include the country code: [49] 123 456 7890.

 

The question: how do I read the phone's country value, not just the phone number itself? Is it a special field or a special attribute under the Contact object? I looked at all possible properties, fields and methods there... but couldn't find anything useful.

 

So any hints or insights would be greatly appreciated.

 

We are using Act! 2010 Premium.

 

Thanks

Employee
Posts: 1,163
Country: USA

Re: Reading country codes for phone fields

The PhoneNumber class has a public property of Country Code, once you've captured a phone number you should be able to get/set it's country code. If you have any issues let me know.

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 2
Country: United_Kingdom

Re: Reading country codes for phone fields

OK, that helped. Thanks!
New Member
Posts: 2
Country: USA

Re: Reading country codes for phone fields

Hi Matthew,

PhoneNumber Class did not help me.

I have got CurrentContact value from Application.ApplicationState.CurrentContact. I need to recieve a full phone number (including country code) for this contact but i do not see any property in thos class to assign to PhoneNumber class. I tried to do the following:

 

       Contact contact = application.ApplicationState.CurrentContact;

       string phonenum = contact.ContactFields["Contact.Phone"].ToString();

       Act.Framework.Phones.PhoneNumber PhoneNum = application.ActFramework.PhoneManager.GetPhoneNumberFromString(phonenum, contact);

       string FullNum=PhoneNum.CountryCode.ToString()+PhoneNum.FormattedNumber;

 

This code does not give desired result. Can you  please say what i am doing wrong? Probably some other class or function should be used.