Community
Showing results for 
Search instead for 
Do you mean 
Reply

GetNotes incorrect count

Bronze Super Contributor
Posts: 1,231
Country: USA

GetNotes incorrect count

Getting the notes for the current contact works using this code...

Me.HostFramework.Notes.GetNotes(Nothing, Me.HostApplication.ApplicationState.CurrentContact)

 

All the three other methods are not working using the same method. They all incorreclt return nothing.

 

// GROUP

Me.HostFramework.Notes.GetNotes(Nothing, Me.HostApplication.ApplicationState.CurrentGroup, ComponentModel.AggregationType.All, Nothing, True)

 

// COMPANY

Me.HostFramework.Notes.GetNotes(Nothing, Me.HostApplication.ApplicationState.CurrentCompany, ComponentModel.AggregationType.All, Nothing, True)

 

// OPPORTUNITY

Me.HostFramework.Notes.GetNotes(Nothing, Me.HostApplication.ApplicationState.CurrentOpportunity, Nothing, True)

 

Is this a known issues? Is there a ticket number I can track?

 

Thanks

-- Jim Durkin

Silver Super Contributor
Posts: 2,328
Country: USA

Re: GetNotes incorrect count

Jim,

 

I've never been able to get it to work when I use "nothing" for a filter criteria.  When I create a filter criteria and assign it the value "nothing" and use it then it works.  I haven't ever tried to figure out what the difference is but you might give that a try.

 

Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: GetNotes incorrect count

[ Edited ]

Finally got it to work. Here is the code for anybody else.

 

'-----------------------------------------------------
' Get the Created_Date field descriptor
'-----------------------------------------------------
Dim CreatedFieldDescriptor As Act.Framework.Notes.NoteFieldDescriptor = Me.HostFramework.Notes.GetFieldDescriptor(Act.Framework.Notes.NoteField.CreateDate)

'-----------------------------------------------------
' Create a Filter Criteria
'-----------------------------------------------------
Dim AllCriteriasArray As IFilterCriteria() = New IFilterCriteria(0) {}
AllCriteriasArray(0) = New FilterClause(New IFilterCriteria() {New DateFilterCriteria(CreatedFieldDescriptor, HostFramework.Activities.MIN_SMALL_DATE_TIME, HostFramework.Activities.MAX_SMALL_DATE_TIME)})

'-----------------------------------------------------
' Create a Soert Criteria
'-----------------------------------------------------
Dim mySortCriteria(0) As Act.Framework.Notes.NoteSortCriteria
mySortCriteria(0) = New Act.Framework.Notes.NoteSortCriteria(CreatedFieldDescriptor, 0)

'-----------------------------------------------------
' Get the count of all the notes attached to the current company
'-----------------------------------------------------
Dim count As Integer = Me.HostFramework.Notes.GetNotes(mySortCriteria, Me.HostApplication.ApplicationState.CurrentCompany, ComponentModel.AggregationType.All, AllCriteriasArray, False).Count

 

 

Thanks for the hint Stan. Bad Mojo in my brain today.

 

-- Jim Durkin

 

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: GetNotes incorrect count

[ Edited ]

Stan,

IT DOES WORK with the sort and filter criteria set to nothing.

 

If you notice in my "Works" code I changed the deferInitalLoad from TRUE to FALSE. 

In fact the original code I posted all works if I change the deferInitalLoad parameter to FALSE.

 

Here is the simplified way to get the notes without building criteria.

 

// GROUP

Me.HostFramework.Notes.GetNotes(Nothing, Me.HostApplication.ApplicationState.CurrentGroup, ComponentModel.AggregationType.All, Nothing, FALSE)

 

// COMPANY

Me.HostFramework.Notes.GetNotes(Nothing, Me.HostApplication.ApplicationState.CurrentCompany, ComponentModel.AggregationType.All, Nothing, FALSE)

 

// OPPORTUNITY

Me.HostFramework.Notes.GetNotes(Nothing, Me.HostApplication.ApplicationState.CurrentOpportunity, Nothing, FALSE)

 

I will leave the above code available if somebody needs to build filter and sort criterias.

 

Hope this helps others.

-- Jim Durkin

 

 

Silver Super Contributor
Posts: 2,328
Country: USA

Re: GetNotes incorrect count

Jim,

 

Sorry.  I've been tied up all day.  I noticed that you had DeferInitialLoad set to True and I usually set it to False.  That's probaby because it didn't work if you set it to True.  I probably changed the filter and the defer at the same time so I thought that using "nothing" for the filter didn't work but creating a filter and setting it to nothing did work.  I appreciate the update.  It did bother me every time I did it since I didn't think it should matter.  Sounds like Swiftpage should check out the code path when you select True for defer initial load.


Stan


If you would like to get more out of ACT! you can find an ACT! Certified Consultant near you by going to:www.act.com/acc.
-------------------------------------------------------------------------------------
Stan Smith
ACT! Certified Consultant
ADS Programming Services, Inc.
(205) 222-1661
www.adsprogramming.com
www.actwebhosting.com
Click Here to Purchase Act!