Community
Showing results for 
Search instead for 
Do you mean 
Reply

Creating Phone Fields

Nickel Super Contributor
Posts: 441
Country: UK

Creating Phone Fields

Does anyone have a quick sample of how to create a phone field.  I can create any other field but when your try and create one for phone I get the message : Phone fields must be created from a template.......
 
Thanks
 
Tom
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Creating Phone Fields

Hi Tom,
 
Its quite funny I hit the same thing earlier today building an internal utility! Haha! Anyway, this is how I got around it:
 

if (fDataType.Equals(Act.Framework.Database.FieldDataType.Phone))

{

Act.Framework.Database.PhoneTemplate oPhoneTemplate = new Act.Framework.Database.PhoneTemplate(sFieldName, Act.Framework.RecordType.Company);

Act.Framework.Database.TemplateManager oTemplateManager = new Act.Framework.Database.TemplateManager(oFramework);

oTemplateManager.Save(oPhoneTemplate);

}

Basically we both you and I forgot that when it comes to Address and Phone fields ACT! uses an inrenal Template to generate the (for Phone fields) the Phone field PLUS an additional Phone Ext field! So it has to be informed of which Template to use...enter the TemplateManager!
 
I have no idea if this is an efficient method or not, hopefully Mark or Carlton might be able to come up with a better method then my somewhat cumbersome approach.
 
Let me know if it works for you.
 
Vivek

 

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Nickel Super Contributor
Posts: 441
Country: UK

Re: Creating Phone Fields

Hi Vivek,
Perfect Smiley Very Happy . I had actually got as far as creating the new template but couldn't work out what to do next... didn't see the Template Manager; easy when you know how Smiley Happy
 
Thanks
 
Tom