Community
Showing results for 
Search instead for 
Do you mean 
Reply

Create companies from SDK

New Member
Posts: 1
Country: USA

Create companies from SDK

I am new to using the SDK and I had no trouble adding and deleting contacts.  I have read the Developer's Reference and I have tried to use the help files that come with the SDK but my computer wont load them.  (Is there a copy of the help files that is in comething besides .chm format?)

 

My product uses an access database and my users want to move to using ACT to manage their contacts and companies so I need to read contacts AND COMPANIES from ACT and store in my database and I need to read contacts AND COMPANIES from my database and put them into ACT.

 

I had no problem with the contacts but I can't figure out how to instantiate the company objects in the ACT SDK.  I can get the list of companies from:

 

mActFramework.Companies.GetAllCompanies(Act.Framework.Interop.CompanySortOrder.Name, True, True)

 

but that doesn't give me all the data like address info.   I also can't figure out how add a company because I can't seem to connect my mActFramework.Logon()   to a CompanyList.    Since I can't seem to read the helpfiles I am working without a net here.

 

 

Can someone post an example that creates a company object, hard codes its name, address, street, etc, connects to an act database, and adds that company and saves it  from the SDK?  (I assume that pulling the full data the other way woul be similar.)   I'd prefer VB.NET since that's what I am forced to use but I should be able to translate from C#.

 

Copper Contributor
Posts: 43
Country: USA

Re: Create companies from SDK

Hi

 

Assuming you have logged into the framework and have fw

 

Act.Framework.Companies.CompanyManager mgr = fw.Companies;

Act.Framework.Companies.Company comp = mgr.CreateCompany();

comp.Name = "MyCompany";

comp.Update();

 

To set the individual fields, you need to get the CompanyFieldCollection and select each item you want to update.

 

You really need to get a machine that lets you read the .chm files - life will be tough until you do.

 

You could save yourself a lot of time by using Inaport for ACT (from us) or itImport. These products are fully working and debugged import engines that have a lot of functionality that would take you a *long* time to replicate.

 

HTH

Regards


David Evans

Inaport - CRM Integration

 

New Member
Posts: 1
Country: USA

Re: Create companies from SDK

This is a developer network. I am a developer who wants to learn the SDK in order to provide the best integration services to my client base. I am a little annoyed that many of the posted replies in this forum seem to be selling additional products. Like the original poster, I need to be able to store company records from another application. I would like to see an example of some code that uses the CompanyFieldCollection to store company details if someone can share that. Thanks.

Copper Contributor
Posts: 43
Country: USA

Re: Create companies from SDK

Hi

 

I replied to the original post with a relevant code snip, and I'll  provide you one, straight from the ACT SDK. I'll also reiterate that you will save a lot of time using a product such as Inaport or itImport because it is true; these products have thousands of man hours invested in them to develop a raft of funtionality that is difficult to emulate.

 

Regards

 

David Evans

Inaport - CRM Integration

 


public Company.CompanyFieldCollection CompanyFields {get;}

//Example 1
Company cCompany;
string  sFieldName;
object  oValue;
.
oValue = cCompany.CompanyFields[sFieldName, true];

//Example 2
//This example displays the name and address of the first company on a CompanyList.

CompanyList cList = ActFwk.Companies.GetCompanies(null);
Company cCompany = cList[0];
object oName  = cCompany.CompanyFields["TBL_COMPANY.NAME", true];
object oLine1 = cCompany.CompanyFields["TBL_COMPANY.BUSINESS_LINE1", true];
object oLine2 = cCompany.CompanyFields["TBL_COMPANY.BUSINESS_LINE2", true];
object oLine3 = cCompany.CompanyFields["TBL_COMPANY.BUSINESS_LINE3", true];
object oCity  = cCompany.CompanyFields["TBL_COMPANY.BUSINESS_CITY",  true];
object oState = cCompany.CompanyFields["TBL_COMPANY.BUSINESS_STATE", true];
object oZip   = cCompany.CompanyFields["TBL_COMPANY.BUSINESS_POSTALCODE", true];
string sMess  = "";
if(oName  != null) {sMess = oName.ToString() + "\n";};
if(oLine1 != null) {sMess = sMess + oLine1.ToString() + "\n";}
if(oLine2 != null) {sMess = sMess + oLine2.ToString() + "\n";}
if(oLine3 != null) {sMess = sMess + oLine3.ToString() + "\n";}
if(oCity  != null) {sMess = sMess + oCity.ToString()  + ", ";}
if(oState != null) {sMess = sMess + oState.ToString();}
if(oZip   != null) {sMess = sMess + " " + oZip.ToString();}
MessageBox.Show(sMess);