Community
Showing results for 
Search instead for 
Do you mean 
Reply

CurrentContactList from "dirty lookup"?

Copper Contributor
Posts: 87
Country: USA

CurrentContactList from "dirty lookup"?

I have a plugin that uses the CurrentContactList to process all the records in the current lookup, but when the lookup was created by tagging records in the Contact List View and then using the "Lookup Tagged" button, the results of using the CurrentContactList is only the current contact, NOT all the selected contacts.  The same appears to be the case when the current lookup is created using a group's membership to perform the lookup.

 

If CCL doesn't always return the current lookup, then 2 questions come to mind.  1) how CAN the program get access to the current contact list when its from a "dirty lookup", and 2) how should the program decide when to use CCL and when to use the other method?

 

TIA,

Geoff

Geoff Blood ("The ACT! Customizer" )
The New Hampton Group

ACT Development Partner
Serving the ACC community since 1994
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: CurrentContactList from "dirty lookup"?

Hi Geoff,

 

This one had me really stumped for ages a while ago but I managed to solve it! I would love to be able to say I used my own peanut sized brain on this but alas I found it in an old and dusty copy of the ACT! 2005 SDK Samples chm Smiley Very Happy

 

Act.UI.IProvideSelectedContacts cLSource = (Act.UI.IProvideSelectedContacts)Class1.actApp.CurrentView;
            if (cLSource!=null)
            {
                Act.Framework.Contacts.ContactList cList = cLSource.GetSelectedContacts();
                listBox1.Items.Clear();
                foreach (Act.Framework.Contacts.Contact c in cList)
                {
                    listBox1.Items.Add(c.FullName);
                }
            }

HTH

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Copper Contributor
Posts: 87
Country: USA

Re: CurrentContactList from "dirty lookup"?

Vivek,

Thanks!  That partially answers the first question, if the lookup was creating using LookupTagged.  But what about when the lookup was created from a Group's membership?  Or a Company's members?  Or any other "dirty" lookup?  Is there a reliable way to ALWAYS get the CURRENT LOOKUP - what the USER expects when you mention or reference the "current lookup"?  What gets processed when you use Edit > Replace to process a list of records? If ApplicationState.CurrentContactList is not ALWAYS the Current Lookup, then what is?

 

And, programmatically, how do you decide whether to use the GetSelectedContacts or the ApplicationState.GetContactList?  Is it true that only one or the other has any content, and that checking for !=null will determine which to use?

 

Seems to me that it should be straight forward, but MY pea sized brain can't get a handle on it, either :-)

 

Thanks in advance,

Geoff

Geoff Blood ("The ACT! Customizer" )
The New Hampton Group

ACT Development Partner
Serving the ACC community since 1994
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: CurrentContactList from "dirty lookup"?

Hi Geoff,

 

Well this is a bit weird now! I have just tried out the whole thing from fresh and actApp.ApplicationState.CurrentContactList; returns the correct current cList. I am running 10.01. Now I know for a fact that I had real issues with this back in 8.00 days so maybe it has been resolved or I am writing working code now-a-days ...Hurrah!

 

Try this out and let me know if it works for you (I suspect that you already have but it works for me)...

ContactList cList = Class1.actApp.ApplicationState.CurrentContactList;
            foreach (Contact c in cList)
            {
                listBox1.Items.Add(c.FullName);
            }

Class1 is just a static hoilding the actApp.

 

HTH

Vivek

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Copper Contributor
Posts: 87
Country: USA

Re: CurrentContactList from "dirty lookup"?

Vivek,

Which version/build are you using for this?  I've tried that (almost) exact same code in 9.0.1 and it does NOT work as described.

Geoff

Geoff Blood ("The ACT! Customizer" )
The New Hampton Group

ACT Development Partner
Serving the ACC community since 1994
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: CurrentContactList from "dirty lookup"?

Hi Geoff,

 The previous code I had done on 10.0.1 (cant remember build but can post if you want). But the very weird thing is I decided to fire up a VM with 8.0.2.81 and ran the following code:

from Plugin.cs:
private void oActApp_ViewLoaded(object sender, ViewEventArgs e)
		{
			Form1 f1 = new Form1();
			if(Utils.oActApp.CurrentViewName=="Act.UI.IContactListView")
			{
				f1.Show();
			}
		}

From Form1 button click to list contact.fullnames:

 

private void btnGetList_Click(object sender, System.EventArgs e)
		{
			foreach(Contact c in Utils.getCusrrentContactList())
			{
				listBox1.Items.Add(c.FullName);
			}
		}
 

and the method in Utils class:

 

 

public static Act.Framework.Contacts.ContactList getCusrrentContactList()
		{
			return oActApp.ApplicationState.CurrentContactList;
		}

 

Now this straight forward way never used to work for me and so used to have to do backward body-code contortions that has left me with the face I know have permanantly just to do this! Smiley Very Happy But seems to work now!

Anyway, since its 8.0.x code it should work on 9.0.x

 

Vivek 

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Copper Contributor
Posts: 70
Country: USA

Re: CurrentContactList from "dirty lookup"?

Hi Geoff,

 

This was my vb.net solution.

 

Not as elegant as the others that have been submitted, but it works with any lookup, dirty or otherwise.

 

Current ACT! Lookup - tag - omit - whatever. Group lookups too (of course).

 

Enjoy dude.

 

 

 Dim CurList As ContactList = ActApp.ApplicationState.CurrentContactList
 Dim i As Integer = 0
 Dim LeCount As Integer = CurList.Count
 Dim SimpleContactList
 For i = 1 To LeCount
  SimpleContactList = SimpleContactList & CurList.Item(i - 1).FullName
  SimpleContactList = SimpleContactList & vbCrLf
 Next
 MsgBox(SimpleContactList)

 

Cheers,
Kevin
----------------

Kevin Ritch
V8Software.co.uk

London 02070 784-138

 

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: CurrentContactList from "dirty lookup"?

Geoff,

How do you know the CCL is not accurate?  Can you give me any steps to reproduce the issue?

Can you recreate in versions other then ACT 9?

Does this list get updated on the next Application.DoEvents cycle or even on its own thread? 

 

Since I have written Contact List Plus and I am currently coding CLP v3 for ACT 11 I am curious to test and maybe help. 

Call me directly to discuss at 1-973-328-3360 

 

thanks

-- jim durkin

 

Copper Contributor
Posts: 70
Country: USA

Re: CurrentContactList from "dirty lookup"?

Hi Geoff,

 

I am using ACT! 2008 Version 10.01 not the .02 upgrade - that's the first thing. Tomorrow I will test the DLL on 10.2

 

Just so you know, I have tested this routine in 6 different ways.

 

1) Simple lookup LName = "Smith" (1st I wrote an app to import people called "Smith" off my MS Access MDB on the web :-)

2) I went to the contact list and tagged a number of contacts and omitted them from the current lookup 

3) I highlighted a number of contacts and created a lookup of JUST those highlighted contacts 

4) I VIEWED a Group - the Current Lookup became those contacts 

5) I repeated step 1 using the contacts from the group 

6) I created a lookup of Recently Created Contacts

 

In each and EVERY instance - the DLL worked a treat without any errors.

 

FWIW Geoff, I am using Microsoft Visual Studio 2008 and not C# under 2003.

 

I don't know if that has any bearing on this at all?!?

 

Later grooviest of groovy dudes!

 

Cheers,
Kevin
V8Software
631 961-0594

Copper Contributor
Posts: 87
Country: USA

Re: CurrentContactList from "dirty lookup"?

KEvin and Jim,

Thanks for your replies.

 

Many of my AEPs offer the user the choice of operating on the current contact or the current lookup, so it's important that I can consistently and accurately loop thru all contacts/companies/groups in what the user thinks of as "the CURRENT lookup".  And there are lots of ways to arrive at the current lookup - using various lookup oprations, selecting from the various list views, and creating a list using various SDK techniques, among others.  I'd like to know that a single statment can reliable return the "real" current list - the list the USER thinks of as "current".

 

Some users have reported that when you use various lookup, filter and select item techniques to derive their "current list", and then ask the AEP to operate on that Current Lookup, it only works on the current contact/company/group instead of the current LOOKUP of contacts/companies/groups.  In checking the code, if the CurrentContactList is Nothing then it reverts to the CurrentContact (same for Companies and Groups).  So it appears that even tho' there must ALWAYS be a currentContactlist (and sometimes/usually a currentCompanyList and currentGrouplist, depending on how it's contents are determined, the GetCurrentxxxList method doesn't always do so.

Geoff

Geoff Blood ("The ACT! Customizer" )
The New Hampton Group

ACT Development Partner
Serving the ACC community since 1994