Community
Showing results for 
Search instead for 
Do you mean 
Reply

Find Contacts who are in a custom Group

Tuned Listener
Posts: 15
Country: United_Kingdom

Find Contacts who are in a custom Group

I'm a bit lost on creating a LookupCriteria for a custom group.

 

I want to find a contact who meets certain criteria, and is a member of the group "XYZ".

 

I dont know how to create a CriteriaColumn that says "is a member of group XYZ", to replace the ???? in the following code.

 

//Create an array to hold all of the lookup criteria
Criteria[] lCriteria = new Criteria[] { new Criteria(LogicalOperator.And, (byte)0, (byte)0, cColumn2, OperatorEnum.StartsWith, sCompany),
                                        new Criteria(LogicalOperator.End, // This is the end of the criteria
                                                    (byte)0, // Left parenthesis
                                                    (byte)0, // Right parenthesis
                                                    ??????, // Which column to use
                                                    OperatorEnum.DoesNotContain,
                                                    ValueEnum.Nothing) };
 
//Create the Lookup
ContactLookup cLookup = actApp.ActFramework.Lookups.LookupContactsReplace(lCriteria, truetrue);

 

Can anyone help? Thanks in advance.

 

Richard

Employee
Posts: 1,163
Country: USA

Re: Find Contacts who are in a custom Group

If you know the group you want the contacts for, it might be easier to get the group first, then call the GetContacts method on that group.

Matthew Wood
Act! SDK Support
Community Moderator
Tuned Listener
Posts: 15
Country: United_Kingdom

Re: Find Contacts who are in a custom Group

I know the group by name, but how the heck do I get that out of the group list?

 

GetGroups method seems appropriate, but I need an iFilterCriteria according to the "help", but there are no examples, and I have no idea how to set up an iFilterCriteria. All the things I've tried throw errors "unknown column" etc.

 

Where is there a list of the columns in the Act tables? Documentation is a nightmare!

 

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Find Contacts who are in a custom Group

If your code is running in a plugin and the user is on that group then its...

 

Dim cContactList as Act.Framework.Contacts.ContactList

cContactList  = ActApplication.ApplicationState.CurrentGroup.GetContacts(nothing)

 

-- Jim Durkin

Tuned Listener
Posts: 15
Country: United_Kingdom

Re: Find Contacts who are in a custom Group

Unfortunately not. The lookup could be coming from anything the user has done, so I cant guarantee where they start from.

 

The task is to show all contacts that are members of the specific group, where the contact's company name starts with the first five letters of the current contact's company name. So if the contact belongs to "First Bank, UK", then the lookup is to show all contacts with a company name starting "First", and also belonging to the RenewalContacts group. So, it may be that this shows "First Bank Head Office, US", and the contact there who handles their renewals worldwide.

 

(My company doesnt use Companies as defined by ACT, but just uses the much looser contact.CompanyName string field. Dont ask me why... they just did it that way.)

 

I have the filter on the company name working fine. However, combining that with the lookup into Groups, I am completely at a loss.

 

A simple "GetCustomGroupsByName" function would be ideal, but this doesnt exist. Making it appears to be beyond my knowledge at the moment. The whole SortCriteria/FilterCriteria stuff is crazily over-complex.

 

Any guidance?

 

Copper Elite Contributor
Posts: 81
Country: Canada

Re: Find Contacts who are in a custom Group

[ Edited ]

To see a list of the columns and tables that Act uses, you can use ActDiag.exe found in the Act installationn folder. From there you can choose your database and export everything to an excel file and look at all the table names. Take a look at the screenshot below

 

Capture.PNG

Ahsan Khalid

Chief Technology Officer
Keystroke Quality Computing Inc.
www.keystroke.ca

Nickel Contributor
Posts: 175
Country: USA

Re: Find Contacts who are in a custom Group

Here is a sample of what I've done to get a filtered set of Opportunities. I know it's not the contacts, but the process is similar.

 


Dim oppList As Act.Framework.Opportunities.OpportunityList Dim od As Act.Framework.MutableEntities.MutableEntityFieldDescriptor = actf.Opportunities.GetMutableEntityFieldDescriptor("VWT_OPPORTUNITY_STAGE_PROCESS.PROCESS", Act.Framework.MutableEntities.FieldNameType.Real) Dim filter As New Act.Framework.ComparisonFilterCriteria(od, Act.Framework.ComparisonFilterCriteria.Operation.Equals, "Process Name") oppList = actf.Opportunities.GetOpportunities(Nothing, New Act.Framework.IFilterCriteria() {filter})

 

FYI,  actf is my framework variable:

Dim actf As New Act.Framework.ActFramework