Community
Showing results for 
Search instead for 
Do you mean 
Reply

MyHistoryList = ACTFM.Histories.GetHistories(Nothing, MyACTContact) Fails

Highlighted
Astute Commentator
Posts: 197
Country: United States

MyHistoryList = ACTFM.Histories.GetHistories(Nothing, MyACTContact) Fails

Just found out that when retrieving a contact's history in V21 of Act!, this call fails:

    MyHistoryList = ACTFM.Histories.GetHistories(Nothing, MyACTContact) 

 

It returns nothing and an error of Object Not Defined and nothing happens. At least it does not crash Visual Studio, which is good.

 

Any ideas???

 

T

Bronze Super Contributor
Posts: 1,246
Country: USA

Re: MyHistoryList = ACTFM.Histories.GetHistories(Nothing, MyACTContact) Fails

It was a bug they added in v21 to keep us on our toes....

 

You need to pass a sort criteria rather then nothing.

 

Probable a cleaner way to code this but I think it was a late night.....

 

       '-----------------------------------------------------
                                        ' JPD
                                        ' 9.0.0.5
                                        ' We need to pass the sort array in ACt 21.0 
                                        '-----------------------------------------------------
                                        Dim aSort(0) As Act.Framework.Histories.HistorySortCriteria
                                        Dim sortFilterArray As ArrayList = New ArrayList
                                        Dim histField As Act.Framework.Histories.HistoryFieldDescriptor = Durkin.Common.Classes.Histories.GetHistoryFieldDescriptorByANY("CREATE_DATE", HostFramework)
                                        Dim hsort As Act.Framework.Histories.HistorySortCriteria = New Act.Framework.Histories.HistorySortCriteria(histField, System.ComponentModel.ListSortDirection.Ascending)
                                        sortFilterArray.Add(hsort)
                                        sortFilterArray.CopyTo(aSort)

                                        Try
                                            count = Me.HostFramework.Histories.GetHistories(aSort, Me.HostApplication.ApplicationState.CurrentContact, aFilter, False).Count
                                        Catch ex As Exception
                                            ' do nothing
                                        End Try

 

Hope this helps

-- Jim Durkin

Astute Commentator
Posts: 197
Country: United States

Re: MyHistoryList = ACTFM.Histories.GetHistories(Nothing, MyACTContact) Fails

Thank you. It is now working.

 

T