06-24-2009 02:21 AM
i am still having problems implementing a picklist. I am using the SDK's example code to create a new custom subentity, and i would like the users to be able to populate the fields by selecting a value from a picklist. could someone please provide me with a very basic example of how to do this.
07-17-2009 01:35 AM
'create the picklist and add some items
dim pl as new act.framework.picklists.picklist(act.framework.picklists.picklisttype.character,"Test List")
pl.Items.Add(New Act.Framework.PickLists.PickListItem("Test Item", "Test Description"))
'save the picklist
'create your field
Dim field As New Act.Framework.Database.FieldDescriptor("TestField", Act.Framework.RecordType.Contact, Act.Framework.Database.FieldDataType.Character)
'create the picklist attribute for the field
Dim pla As New Act.Framework.Database.PickListAttribute(ActApp.ActFramework.PickLists.GetPickList("Test List"), True, False, True, False)
field.Attributes(Act.Framework.Database.FieldProperty.PickList) = pla
'save the field
'retrieve the picklist for the field so you can add items to your own
'combo box etc...
If Not ActApp.ActFramework.PickLists.GetPickList(field) Is Nothing Then
Dim pl As Act.Framework.PickLists.PickList = ActApp.ActFramework.PickLists.GetPickList(field)
Dim items As Act.Framework.PickLists.PickListItemCollection = pl.Items
For Each item As Act.Framework.PickLists.PickListItem In items
Hope that helps
07-17-2009 02:44 AM
Thank you ever so much for your assistance. I am working IN C++, so used a converter to change your code to C++.
I am having some problems still;
Act.Framework.PickLists.PickList pl = new Act.Framework.PickLists.PickList(Act.Framework.PickLists.PickListType.Character, "Test List", "Test Description", False, False);
is giving me the error "Act.Frameword.PickLists.PickList does not contain a constructor that takes 5 arguments" despite the object browser showing me
"internal PickList(Act.Framework.PickLists.PickListType type, string name, string description, bool isEditable, bool isAutoInsert)"
I am also getting the message
"The name ActApp does not exist in the current context"
Is this supposed to be a placeholder for my application's name? should it be changed to ActApplication?
07-17-2009 03:00 AM
1. I suspect you are missing a reference, the ones I have are :
2. ActApp is just a reference to the act application which is collected when the plugin is loaded (see the sdk samples). If you are working outside the application ie just using the framework you can use the act framework instaed of actapp ie.
Dim ActFwk as new act.framework.actframework
Then just replace ActApp.ActFramework.Dosomething in my sample with ActFwk.DoSomething
Hope some of that makes sense