Community
Showing results for 
Search instead for 
Do you mean 
Reply

Looking for a sample project

Avid Listener
Posts: 9
Country: United States

Looking for a sample project

Externally to ACT:

 

Can anyone point me to a Visual Studion .NET app (VB) that contains a working sample of:

1) Adding a record to the CONTACT table

2) Update a field in the CONTACT table.

3) Queries the CONTACT table for a record

 

Although I've worked with ACT in the past, It's my first experience with the ACT database being a Microsoft SQL database.  

 

My version:

ACT! by Sage Premium for Web 2010 Version 12.0.409, Hotfix 3

 

I've written web apps that access Microsoft SQL and Mysql databases in the past but am having a bit of trouble getting over the SDK learning curve.

 

My intention is to write a lead acceptor to allow data collected on web forms to make it into the ACT contacts table with the ability to query the contacts table first to handle duplicates.

 

Thanks in advance.

Employee
Posts: 1,163
Country: USA

Re: Looking for a sample project

I don't have a project already put together, but I can provide some sample code that accomplishes these tasks. 

 

    //Create new contact

            Contact c = afw.Contacts.CreateContact();

            c.Company = "Company";            

            c.FirstName = "John";

            c.LastName = "Doe";

            //...etc for various contact table specific info

            c.Update();

 

            //IIRC this works, but haven't done it in a while

            c.Fields["FIELD NAME"] = "";

            object str = c.Fields["FIELD NAME"];

 

            //This I think is the preferred approach

            DBFieldDescriptor fd = afw.Contacts.GetFieldDescriptor("TBL_CONTACT.FULLNAME");

            ContactList cl = afw.Contacts.GetContacts(null);            

            fd.GetValue(c);

            fd.SetValue(c, "TEST"); 

 

HTH 

Matthew Wood
Act! SDK Support
Community Moderator
Employee
Posts: 1,163
Country: USA

Re: Looking for a sample project

Almost forgot, you can also use the OLE to access table data outside the application

 

       DataTable dt = new DataTable("myTable");                        

            

            OleDbConnection strConn = new OleDbConnection(ActFwk.CurrentACTOLEDB2);

 

            OleDbCommand command = new OleDbCommand("SELECT TOP 50 [ContactID] FROM TBL_CONTACT", strConn);

 

            OleDbDataAdapter oleAdapter = new OleDbDataAdapter(command);

 

            try

            {

            strConn.Open();

            }

            catch(OleDbException e)

            {

                MessageBox.Show(e.ToString());

            }

 

            oleAdapter.Fill(dt);            

 

            strConn.Close();

 

            dgOle.DataSource = dt;

Matthew Wood
Act! SDK Support
Community Moderator
Avid Listener
Posts: 9
Country: United States

Re: Looking for a sample project

Thanks so much for the quick response!

 

I'll definitely give the code snippets a try.

 

I've found that code snippets work much better for me than an object reference guide.

 

Does anyone have a working vb.net project (see above for short requirements) even for a fee? 2003/2005/2008/etc?

 

I'm looking forward to working this out (you always learn more that way), but time is short.

 

Copper Contributor
Posts: 51
Country: United States

Re: Looking for a sample project

+1 to John's request.  It sounds as if John and I are in the same boat.  mwood's response is informative but not quite complete in that it doesn't show any using/include files that are needed.  I have a binder of samples but none show everything.  As with John VB would be great though I can dissect C#.

 

My client's IT manager is setting up a development server as I type so hopefully I'll be able to take this for a test drive.

 

Thanks.

 

Larry

Employee
Posts: 1,163
Country: USA

Re: Looking for a sample project

Within the SDK download should be two zip files, CustomMenuPlugin.zip and ContactNameControl.zip, both contain .cs files that may be more along the lines of what your looking for. As a very broad, general rule, for any Act! development your going to require Act.Framework.dll, if your creating a plug-in you'll need Act.UI.dll and Act.UI.Core.dll. Add those as references and at that point if you are typing in VS and a using statement is required it'll let you know and add it for you.

 

Trying to be helpful,

Matt 

 

 

Matthew Wood
Act! SDK Support
Community Moderator
Nickel Elite Contributor
Posts: 937
Country: USA

Re: Looking for a sample project

The sample located here:
 
 
Is for adding Notes but is pretty close to what you re looking for in terms of architecture and API access.  This uses a separate instance of the framework (meaning it's not a plugin or control), which is the same basic approach you need for the described solution.
 
Allen 
 
 
Nickel Elite Contributor
Posts: 937
Country: USA

Re: Looking for a sample project

Also,
 
the RESTACT portion of the iphone project source located here:
 
  
Is a pretty good starter in the direction of implementing a webservice for ACT!, though I'll say the code as posted in this sample is incomplete.
 
Depending on demand/need - ACT! 2011 will have some additional SDK features that will help make these kinds of things easier from a custom code development perspective (a Contact web service in the APFW client).