Community
Showing results for 
Search instead for 
Do you mean 
Reply

Contact Picker - Where Is It?

Accepted Solution Solved
Nickel Super Contributor
Posts: 352
Country: Canada
Accepted Solution

Contact Picker - Where Is It?

I am nearly certain I've done this before but can't find the code, nor any other documentation.

 

I want the user to be able to choose a contact, using the standard "ACT! contact picker" dialog.  I am pretty sure I can instantiate one and get a ContactList back from it.

 

Can someone recall where this is and point me to it?

 

Thanks,

Len

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training

Accepted Solutions
Solution
Accepted by topic author lkamerman
‎09-25-2015 03:20 AM
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Contact Picker - Where Is It?

[ Edited ]

Try this...

 

 

PublicSharedFunction GetContactListfromPicker(ByVal HostFramework As Act.Framework.ActFramework, _

   ByVal SelectedContacts As Act.Framework.Contacts.ContactList) As Act.Framework.Contacts.ContactList

       

Try

 

           

'---------------------------------------------------------

' Create the default sort order

'---------------------------------------------------------

           

Dim FLD1 As Act.Framework.Contacts.ContactFieldDescriptor = HostFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.LASTNAME", True)

           

Dim FLD2 As Act.Framework.Contacts.ContactFieldDescriptor = HostFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.FIRSTNAME", True)

           

'Create a sort criteria array

Dim sort() As Act.Shared.Collections.SortCriteria

sort = New Act.Shared.Collections.SortCriteria() {New Act.Shared.Collections.SortCriteria(FLD1, System.ComponentModel.ListSortDirection.Ascending), New Act.Shared.Collections.SortCriteria(FLD2, System.ComponentModel.ListSortDirection.Ascending)}

           

'---------------------------------------------------------

' Get ACT's native 'Contact Picker

'---------------------------------------------------------

Dim oformPicker As Act.UI.Contacts.ContactPickerDialog = _

New Act.UI.Contacts.ContactPickerDialog(CommonPlugin.ACTAPP, _

                                HostFramework.Contacts.GetContacts(sort), _

                                SelectedContacts)


oformPicker.SelectedContactRequired = True

oformPicker.Text ="Select Contacts"

           

'------------------------------------------

' Show the ACT ContactPickerDialog

'------------------------------------------

If oformPicker.ShowDialog() = Windows.Forms.DialogResult.OK Then

    ' return nothing cause nothign was selected

    If oformPicker.SelectedContacts.Count = 0 Then

       Return Nothing

    Else

        Return oformPicker.SelectedContacts

    End If

Else

     Return Nothing

EndIf

       

Catch ex AsException

Throw ex

End Try

   

EndFunction

 

 

-- Jim Durkin

View solution in original post


All Replies
Solution
Accepted by topic author lkamerman
‎09-25-2015 03:20 AM
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Contact Picker - Where Is It?

[ Edited ]

Try this...

 

 

PublicSharedFunction GetContactListfromPicker(ByVal HostFramework As Act.Framework.ActFramework, _

   ByVal SelectedContacts As Act.Framework.Contacts.ContactList) As Act.Framework.Contacts.ContactList

       

Try

 

           

'---------------------------------------------------------

' Create the default sort order

'---------------------------------------------------------

           

Dim FLD1 As Act.Framework.Contacts.ContactFieldDescriptor = HostFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.LASTNAME", True)

           

Dim FLD2 As Act.Framework.Contacts.ContactFieldDescriptor = HostFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.FIRSTNAME", True)

           

'Create a sort criteria array

Dim sort() As Act.Shared.Collections.SortCriteria

sort = New Act.Shared.Collections.SortCriteria() {New Act.Shared.Collections.SortCriteria(FLD1, System.ComponentModel.ListSortDirection.Ascending), New Act.Shared.Collections.SortCriteria(FLD2, System.ComponentModel.ListSortDirection.Ascending)}

           

'---------------------------------------------------------

' Get ACT's native 'Contact Picker

'---------------------------------------------------------

Dim oformPicker As Act.UI.Contacts.ContactPickerDialog = _

New Act.UI.Contacts.ContactPickerDialog(CommonPlugin.ACTAPP, _

                                HostFramework.Contacts.GetContacts(sort), _

                                SelectedContacts)


oformPicker.SelectedContactRequired = True

oformPicker.Text ="Select Contacts"

           

'------------------------------------------

' Show the ACT ContactPickerDialog

'------------------------------------------

If oformPicker.ShowDialog() = Windows.Forms.DialogResult.OK Then

    ' return nothing cause nothign was selected

    If oformPicker.SelectedContacts.Count = 0 Then

       Return Nothing

    Else

        Return oformPicker.SelectedContacts

    End If

Else

     Return Nothing

EndIf

       

Catch ex AsException

Throw ex

End Try

   

EndFunction

 

 

-- Jim Durkin

Nickel Super Contributor
Posts: 352
Country: Canada

Re: Contact Picker - Where Is It?

Wow, thanks Jim!  The only way that could have been better is if it was in C# (kidding!)

 

That dialog let me build a feature where a user picks a quote he's done in the past, click duplicate, pick the contact, and then create a copy of the quote and opportunity records and launch the editor.  Their sales people will love it.

 

Thanks!!

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Contact Picker - Where Is It?

[ Edited ]

C# provided by http://www.developerfusion.com/tools/convert/vb-to-csharp/

 

public static Act.Framework.Contacts.ContactList GetContactListfromPicker(Act.Framework.ActFramework HostFramework, Act.Framework.Contacts.ContactList SelectedContacts)
{

try {

//---------------------------------------------------------
// Create the default sort order
//---------------------------------------------------------
Act.Framework.Contacts.ContactFieldDescriptor FLD1 = HostFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.LASTNAME", true);
Act.Framework.Contacts.ContactFieldDescriptor FLD2 = HostFramework.Contacts.GetContactFieldDescriptor("TBL_CONTACT.FIRSTNAME", true);

//Create a sort criteria array
Act.Shared.Collections.SortCriteria[] sort = null;
sort = new Act.Shared.Collections.SortCriteria[] {
new Act.Shared.Collections.SortCriteria(FLD1, System.ComponentModel.ListSortDirection.Ascending),
new Act.Shared.Collections.SortCriteria(FLD2, System.ComponentModel.ListSortDirection.Ascending)
};

//---------------------------------------------------------
// Get ACT's native 'Contact Picker
//---------------------------------------------------------
Act.UI.Contacts.ContactPickerDialog oformPicker = new Act.UI.Contacts.ContactPickerDialog(CommonPlugin.ACTAPP, HostFramework.Contacts.GetContacts(sort), SelectedContacts);

oformPicker.SelectedContactRequired = true;
oformPicker.Text = "Select Contacts";

//------------------------------------------
// Show the ACT ContactPickerDialog
//------------------------------------------
if (oformPicker.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
     // return nothing cause nothign was selected
     if (oformPicker.SelectedContacts.Count == 0) {
        return null;
     }

     else {
          return oformPicker.SelectedContacts;
     }
}

else {
   return null;
}

} catch (Exception ex) {
     throw ex;
}

}

Nickel Super Contributor
Posts: 352
Country: Canada

Re: Contact Picker - Where Is It?

Hey, that's pretty sharp!

 

I understand VB.NET well enough since that's what I wrote before taking the ACT! SDK class back in '05 and converting to C#, but that's a neat tool.  I still end up transposing some declarations when I'm reading VB, so that's helpful.

 

Thanks,

Len

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training