Community
Showing results for 
Search instead for 
Do you mean 
Reply

Finding selected objects; and accessing fields

New Member
Posts: 1
Country: United States

Finding selected objects; and accessing fields

Hello,

I am trying to develop a plug-in for Act.

How can I enumerate currently selected entries in Contact List view?

ContactList cl = application.ActFramework.Contacts.GetContacts(null)

returns me all the entries (in the database? in the search?), however subsequent

cl = application.ActFramework.Contacts.GetTaggedContacts(sortCriteria, cl)

returns empty list, whether the entries are explicitly tagged and the list is in "tag mode", or just selected.

Another question: How can I retrieve phone number, address etc. for a Contact object?

I tried to call Contact.Fields, but it returns empty FieldCollection, i.e. GetEnumerator() on the collection returns a enumerator with MoveNext() returning false on the very first call.

Thanks,
Sergey
Employee
Posts: 1,163
Country: USA

Re: Finding selected objects; and accessing fields

If your looking for the current lookup, the most straightforward way might be:

ContactList cl = actApp.ApplicationState.CurrentContactList;

 

If the above doesn't get you what your looking for I could take a look at why GetTaggedContacts isn't returning the expected results.

 

As for retrieving field specific info for a contact you were on the right track with Contact.Fields, just needed to add the field you were looking for like Contact.Fields["FieldName", isReal] -- I personally have better luck with field aliases than real field names but either are acceptable. 

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 9
Country: USA

Re: Finding selected objects; and accessing fields

Sorry to resurrect an old thread, but I have a similar issue.  I have a menu option that triggers an action through the SDK that needs to be able to identify which contacts have been selected on the current Contact List screen.  I use:

 

ContactList cList = currentFramework.CurrentLookupContactList

 

To obtain the Contact List object, but can't seem to find any way to identify which of those contacts have been selected (highlighted) by the user.

 

How can this be accomplished?

Employee
Posts: 1,163
Country: USA

Re: Finding selected objects; and accessing fields

Is the TaggedItems property not returning the items in the list that have been tagged? I remember the previous poster having an issue with this but he didn't respond since the initial post so I assumed it was resolved.

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 9
Country: USA

Re: Finding selected objects; and accessing fields

It doesn't ever seem to return any results, but the Contacts aren't necessarily tagged they're just selected.  I think I've got it working by using the following code:

 

IContactView listView = this.application.UIContactManager.GetContactListView();

foreach (Contact contact in listView.GetSelectedContacts())

{

do stuff here.......

}