Community
Showing results for 
Search instead for 
Do you mean 
Reply

Get all Activity Types

Accepted Solution Solved
Copper Super Contributor
Posts: 71
Country: Canada
Accepted Solution

Get all Activity Types

Hello,

I am working on a custom plugin but having an issue, I have on my form a comboBox, I want my plugin to pull in all the different types of activities that are in the database (call, meeting, todo, as well as custom ones) and add them as options in the combo box. Any ideas?


Accepted Solutions
Solution
Accepted by topic author MattRobillard
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Get all Activity Types

You could use a foreach loop on the array of types to add them as items in the combo box. So the psuedo code would be something like:

 

foreach(Type type in TypeArray[])

{

 combobox1.Items.Add(type.Name.toString());

}

Matthew Wood
Act! SDK Support
Community Moderator

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: Get all Activity Types

[ Edited ]

This will get you all of the activity types:

 

ActivityType[] Types = ActApp.ActFramework.Activities.GetActivityTypes();

 

Matthew Wood
Act! SDK Support
Community Moderator
Copper Super Contributor
Posts: 71
Country: Canada

Re: Get all Activity Types

If I wanted to add each activity type as an item in a checkedlistbox control whats the best way to do it. I am not quite sure how the coding would work.

Solution
Accepted by topic author MattRobillard
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Get all Activity Types

You could use a foreach loop on the array of types to add them as items in the combo box. So the psuedo code would be something like:

 

foreach(Type type in TypeArray[])

{

 combobox1.Items.Add(type.Name.toString());

}

Matthew Wood
Act! SDK Support
Community Moderator
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Get all Activity Types

[ Edited ]

You could also bind directly to the datasource of the cbo;

 

Me.cboTypes.DataSource = ACTFramework.Activities.GetActivityTypes(False)

  

Then use the selected item  of the cbo directly like this:

 

ACTFramework.Activities.CreateActivity(Me.cboTypes.SelectedItem)

 

Hope this helps

-- Jim Durkin