Community
Showing results for 
Search instead for 
Do you mean 
Reply

Re: Sample Code for 2011 SDK

Employee
Posts: 1,163
Country: USA

Re: Sample Code for 2011 SDK

Hello blicci,

 

Are you looking for the sample code in the SDK download? Are you looking for a code sample not included in the SDK?

 

How can I help you?

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 16
Country: USA

Re: Sample Code for 2011 SDK

I guess I'm looking for a sample not in the SDK.
What I am trying to do is an initial load of companies from another system into Act which I had no problem doing, but now I am trying to figure out how to set the address fields for a company.

I will also be performing a nightly refresh of a handful custom fields as well. I know there are third party systems that can do this but I would rather do it myself.

Thanks

Employee
Posts: 1,163
Country: USA

Re: Sample Code for 2011 SDK

I have a sample of setting field values for contacts, but not companies, this shouldn't be an issue though.

 

Contact c = _ActApp.ApplicationState.CurrentContact;
ContactFieldDescriptor userField3 = _ActApp.ActFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.USER3");
c.Fields["TBL_CONTACT.USER3", Act.Framework.MutableEntities.FieldNameType.Real] = "TEST";
c.Update();


or

Contact c = _ActApp.ApplicationState.CurrentContact;
ContactFieldDescriptor userField3 = _ActApp.ActFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.USER3");
userField3.SetValue(c, "Value");
c.Update();

 

Hopefully that will get you going in the right direction.

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 16
Country: USA

Re: Sample Code for 2011 SDK

Thanks,
That helped. I got it to work like this
Act.Framework.Companies.CompanyFieldDescriptor descr = _framework.Companies.GetCompanyFieldDescriptor("TBL_COMPANY.BUSINESS_LINE1", Act.Framework.MutableEntities.FieldNameType.Real);
descr.SetValue(company, "Test Address");
company.Update();

I'm not sure why TBL_COMPANY.BUSINESS_LINE1 works though. Business line 1 is not a column in TBL_COMPANY. I would think it should be "TBL_ADDRESS.LINE1" which is a real column in the TBL_ADDRESS table. Is there a reference guide somewhere that I can use with this type of stuff in it?