Showing results for 
Search instead for 
Do you mean 

Contact information

Tuned Listener
Posts: 23
Country: United Kingdom

Contact information

This is my first stab at the ACT 2009 SDK. I want to populate a list box with all open opportunities that have an ‘Open’ status, I have managed this with the code below (obtained from within this forum) which I would like to add other information to. Specifically I would like to add the value of the field ‘Account Ref’ a user field within the contact associated with the opportunity I would also like to get the id for the opportunity. The code I have is:

Public Sub GetOpportunities()
        Dim ACTFM As New ActFramework()
        Dim RecI As Integer = 0
        ACTFM.LogOn("Login Details")
            Dim oList As Act.Framework.Opportunities.OpportunityList
            Dim opp As Act.Framework.Opportunities.Opportunity
            Dim cContact As Act.Framework.Contacts.Contact
            oList = ACTFM.Opportunities.GetOpportunities(Nothing)

            If Not (oList Is Nothing) Then
                For I As Integer = 0 To oList.Count - 1
                    If (oList.Item(I).Process.Name) = "Quote Enquiries" Then
                        ' If (oList.Item(I).OpenDate) > DateAdd(DateInterval.Month, -3, DateTime.Now) Then
                        opp = oList(I)
                        Dim cList As List(Of Act.Framework.Contacts.Contact) = opp.Contacts
                        cContact = cList(0)
                        If (opp.Status) = Act.Framework.Opportunities.OpportunityStatus.Open Then

                            Me.CheckedListBox1.Items.Add(opp.DaysOpen & " " & oList.Item(I).ManagerName & " " & opp.Total & " " & opp.ContactName & " " & oList.Item(I).Details & " From " & oList.Item(I).OpportunityFields(0) & ", " & oList.Item(I).OpportunityFields(1) & "  To: " & _
                            oList.Item(I).OpportunityFields(2) & " " & oList.Item(I).OpportunityFields(3) & " " & oList.Item(I).OpportunityFields(4))
                            RecI = RecI + 1
                        End If
                    End If
                    ' End If
            End If
        Catch ex As Exception
        End Try
    End Sub



Tuned Listener
Posts: 23
Country: United Kingdom

Re: Contact information

[ Edited ]



I think I have found the solution in the SDK to the first part of my problem, that is getting the user field information back for the record using the code  below:


Dim cList As List(Of Act.Framework.Contacts.Contact) = opp.Contacts

cContact = cList(0)

Dim cField As Act.Framework.Contacts.ContactFieldDescriptorcField = ACTFM.Contacts.GetContactFieldDescriptor("TBL_CONTACT.USER2")

oValue = cField.GetValue(cContact)

If oValue = Nothing Then oValue = "////////"


The Account Ref field was the USSER2 field and the code from the SDK returns this, I have also found the ID in the ID field of all places!!!! Anyway on to the next issue how would I use this to reference the opportunities record and change its status?




Message Edited by JoeBo on 02-24-2009 09:12 AM