Community
Showing results for 
Search instead for 
Do you mean 
Reply

Picklist issues still

Tuned Listener
Posts: 8
Country: United Kingdom

Picklist issues still

Hi guys,

 

 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.

 

many thanks,

Mark.

Tuned Listener
Posts: 8
Country: United Kingdom

Re: Picklist issues still

bump. The code to create a new subentity works fine, i just want to add some code so that the fields are completed via picklists. Any help would be much appreciated.
Nickel Super Contributor
Posts: 441
Country: UK

Re: Picklist issues still

'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

actapp.actframework.picklists.updatepicklist(pl)

 

 

'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

ActApp.ActFramework.Fields.Save(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
 msgbox(item.Value)
 Next

end if

 

 

Hope that helps

 

Tom

Tuned Listener
Posts: 8
Country: United Kingdom

Re: Picklist issues still

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;

 

the line

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?

Nickel Super Contributor
Posts: 441
Country: UK

Re: Picklist issues still

1. I suspect you are missing a reference, the ones I have are :

 

Act.UI.dll

Act.UI.Core.dll

Act.Framework.dll

Act.Framework.ComponentModel.Core.dll

Act.Shared.Collections.dll

 

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

ActFwk.LogOn(Logon details)

 

 Then just replace ActApp.ActFramework.Dosomething in my sample with ActFwk.DoSomething

 

Hope some of that makes sense Smiley Happy

 

Tom