Community
Showing results for 
Search instead for 
Do you mean 
Reply

Problem in Accessing the SDK and Need Custom fields

Accepted Solution Solved
New Member
Posts: 8
Country: India
Accepted Solution

Problem in Accessing the SDK and Need Custom fields

We are having the problem with the import functionality in the SAGE ACT SDK. Currently it can be done Manually - Importing the from .xls for example. the import from another application needs to go into a blank ACT DB, currently the SDK tools dont seems to allow this. Is this by design? If the SDK allows this then can u please advise the naming? we want to perform this through the coding instead of manual process if we could get the sample code then it will be great help full for us.

 

Additionally adding the customs layout functionality and the fields is manual at the present. Is development provided for the in the SDK as well, as it doesn't appear to be?

 

 


Accepted Solutions
Solution
Accepted by topic author mahender
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Problem in Accessing the SDK and Need Custom fields

[ Edited ]

There's no free phone support for the SDK, however it would seem that in this thread Jim has provided suffecient code to accomplish most of the tasks you've outlined. In what he's provided he shows how to read in contacts from excel into a datasheet and then setting the value of a field with that data.

 

Here is another small sample I had from an existing project showing how to create new fields:

 

FieldDescriptor newField = new FieldDescriptor("TestField", Act.Framework.RecordType.Contact, FieldDataType.Decimal);
newField.AllowEmpty = true;
newField.Attributes[FieldProperty.DecimalPrecision] = new Act.Framework.Database.DecimalPrecisionAttribute(12, 2);
 
ActApp.ActFramework.Database.LockDatabase(Act.Framework.DatabaseLockReason.SchemaChanges);
ActApp.ActFramework.Fields.Save(newField);
ActApp.ActFramework.Database.UnlockDatabase();

This is done in a plugin, so it's UI level. ActApp is the current ActApplication object. 

 

Hope this helps.

Matthew Wood
Act! SDK Support
Community Moderator

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: Problem in Accessing the SDK and Need Custom fields

Hello mahender,

 

Just want to make sure I understand the question clearly. The two tasks that you want to be able to accomplish via the SDK are:

 

1. Performing an import from excel

2. Creating and adding fields to a custom layout

 

Is that correct?

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 8
Country: India

Re: Problem in Accessing the SDK and Need Custom fields

Thanks for the reply. What actualy i need is that i want to perform the importing programatically i mean instead of importing the excel sheet in manual process is it possible with programatically????? we have developed and application where it get all the contacts from Campaign master applications and i want to show that contact details in sage act application. currently we are  importing that contacts to excel sheet from there we are importing to Sage Act. which is manual process. what we are are looking now is that will it possible of creating it thru coding while creating the database with the required fileds on the Sage API.

 

2) According to me Customs fileds means i want to fields to my Sage Api dynamically thru coding instead of design layout will it possible thru coding???? if yes then plz send me the sample application or sdk codec so that we can implement it in my code.

please ping me back if u need futhur clarifications

 

Thanks

Mahender.

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Problem in Accessing the SDK and Need Custom fields

Here is some sudo code to import into ACT!

 

Private Sub ImportfromExcel()

 

        ' Get a reference to the ACT Framework class

        Dim oACTFramework As Act.Framework.ActFramework = New Act.Framework.ActFramework

 

        ' Log on useing the pad file, user name and password

        oACTFramework.LogOn("padfileNameAndPath", "UserName", "password")

 

        ' create a table to store you excel spreadsheet

        Dim oDs As New System.Data.DataSet

 

        ' Create a OLEDB connection string for EXCEL

        Dim cnCSV As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "strExcelFilePath" & ";Extended Properties=""Excel 8.0;HDR=No;""")

        cnCSV.Open()

 

        ' Create a OLEDB select command

        Dim cmdSelect As New OleDb.OleDbCommand(String.Format("SELECT * FROM [{0}$]", "strSheetName"), cnCSV)

        Dim daCSV As New OleDb.OleDbDataAdapter()

        daCSV.SelectCommand = cmdSelect

 

        '' Populate the dataset from the excel spreadshhet

        ' There are other ways but I prefere to work in a dataset rather then the spreadsheet directly

        daCSV.Fill(oDs)

 

 

        For Each cRow As DataRow In oDs.Tables(0).Rows()

            ' Get your contact based on con value from the spread sheet

            ' For sudo code I used MyRecord

            Dim cContact As Act.Framework.Contacts.Contact = Nothing

            cContact = oACTFramework.Contacts.GetMyRecord

 

            ' populate the fields

            GetContactFieldDescriptorByDisplayName(oACTFramework, "Zip Code").SetValue("", cContact)

            ' OR

            GetContactFieldDescriptorByDisplayName(oACTFramework, "Zip Code").SetValue(cRow.Item("Zip Code"), cContact)

 

            ' Save changes to the contact

            cContact.Update()

 

        Next

 

    End Sub

 

    Public Shared Function GetContactFieldDescriptorByDisplayName(ByVal HostFramework As Act.Framework.ActFramework, ByVal sDisplayName As String) As Act.Framework.Contacts.ContactFieldDescriptor

        '------------------------------------------------------------

        ' Check all other fields in the GetContactFieldDescriptors

        ' And return the One where sDisplayName = cField1.DisplayName

        '----------------------------------------------------------------

        Dim cField1 As Act.Framework.Contacts.ContactFieldDescriptor

        Dim cFieldsAll = HostFramework.Contacts.GetContactFieldDescriptors()

        For Each cField1 In cFieldsAll

            If sDisplayName.ToUpper = cField1.DisplayName.ToUpper Then

                Return cField1

                Exit For

            End If

        Next

 

        Return Nothing

    End Function

 

 

-- Jim Durkin

www.durkincomputing.com

 

New Member
Posts: 8
Country: India

Re: Problem in Accessing the SDK and Need Custom fields

Hi Jim thanks for quick reply. Here I have a doubt now... Where should I implement this code now?? I mean do I need to add a button or something else on the Sage Act UI for this code to implement or is it the code to import data from Sage Act to other application? More over I am not using OLE DB connection or any other database connection to import data to SAGE as of now. I  am just just clicking on the file menu and importing the data from other application to SAGE ACT. Can do the same process thru coding by adding some button or something else to import contacts from my local application to sage. Its not mandatory to excel data to SAGE ACT. Tell me any procedure so that I can import the data to SAGE ACT from my local application thru coding.

 

 

Thanks

Mahender

Employee
Posts: 1,163
Country: USA

Re: Problem in Accessing the SDK and Need Custom fields

The code that Jim has provided access Act at the framework level, so it functions independent of Act, there's no need to a button or menu item to run this but that is certainly an alternative. The sample provided reads data in from an excel spreadsheet via an OLEDB connection and then writes the values to Act, I'm unclear on how you intend to read data from your application without some sort of data connection.

 

 

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 8
Country: India

Re: Problem in Accessing the SDK and Need Custom fields

Thanks for the reply. Actually what we are looking from SAGE ACT is that I want to show my contacts in the SAGE UI. Right now we are able to do it by importing it in excel format. Is there any other way so that I can do the same thing thru coding instead of manual process?? And in the contacts which I get from the my local application will contain the Failure,Bounce, Clicked count of Items which we want to show in the UI by adding the custom fileds. Which is possible now thru manual design process which we want to show thru coding. My application will get the contacts from Campaign Master and Want to show them in the SAGE UI. Is there any possibility to talk with support directly? If yes then plz let me know so that I can arrange meeting to resolve my issue.

 

Thanks

Mahender

Solution
Accepted by topic author mahender
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Problem in Accessing the SDK and Need Custom fields

[ Edited ]

There's no free phone support for the SDK, however it would seem that in this thread Jim has provided suffecient code to accomplish most of the tasks you've outlined. In what he's provided he shows how to read in contacts from excel into a datasheet and then setting the value of a field with that data.

 

Here is another small sample I had from an existing project showing how to create new fields:

 

FieldDescriptor newField = new FieldDescriptor("TestField", Act.Framework.RecordType.Contact, FieldDataType.Decimal);
newField.AllowEmpty = true;
newField.Attributes[FieldProperty.DecimalPrecision] = new Act.Framework.Database.DecimalPrecisionAttribute(12, 2);
 
ActApp.ActFramework.Database.LockDatabase(Act.Framework.DatabaseLockReason.SchemaChanges);
ActApp.ActFramework.Fields.Save(newField);
ActApp.ActFramework.Database.UnlockDatabase();

This is done in a plugin, so it's UI level. ActApp is the current ActApplication object. 

 

Hope this helps.

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 8
Country: India

Re: Problem in Accessing the SDK and Need Custom fields

hi thanks for reply. can i have detail code of it? and plz let me know the dll need to added for it and ActApp is it the object of the Actframework class?? do i need to design the fields in SAGE UI before implementing this code ???
Employee
Posts: 1,163
Country: USA

Re: Problem in Accessing the SDK and Need Custom fields

You'll need to reference Act.UI, you can see an example of implementing a plug-in  that adds a menu item in the downloaded documentation. You can create the fields in your code or do it through the UI, makes no difference.

Matthew Wood
Act! SDK Support
Community Moderator