Community
Showing results for 
Search instead for 
Do you mean 
Reply

Create picklist from Product List

mas
New Member
Posts: 1
Country: Canada

Create picklist from Product List

Hi,

 

I'm looking at modifying the sample custom entity add-in (Polcy example) to suit my needs a bit more.

In the sample add-in the creation of a picklist for Policy type is hard-coded in with the items being added at run-time.

 

In my situation the custom entity is very similar to policies but it's for support contracts for software purchases.

So each contract has a product type field.

 

When adding/editing a contract I'd like a picklist to display a product list (similar to adding a line item in an Opportunity) using the Products pulled from my Product Master list.

 

How would I go about doing this?

How can I retrieve a list of Products at run-time and use this list to populate a picklist in my custom sub-entity?

 

Any help or advice would be much appreciated.

Thanks in advance.

 

Copper Contributor
Posts: 98
Country: United States

Re: Create picklist from Product List

[ Edited ]

The policy picklist is set in this segment of code in PolicyPlugin.cs:

 

// Create a picklist for policy types. PickList pickList = this.actApplication.ActFramework.PickLists.CreatePickList(PickListType.Character, "Policy Types", "Policy Types", false, false); // Add items to the picklist. pickList.Items.Add(new PickListItem("Life", "A Life Insurance Policy written for an individual person")); pickList.Items.Add(new PickListItem("Auto", "Auto Insurance Policy covering collision and comprehensive loss")); pickList.Items.Add(new PickListItem("Home", "Homeowners Insurance Policy covering personal loss within an owned dwelling or structure")); pickList.Items.Add(new PickListItem("Health", "A General Health Policy to coverage illness and/or disease")); pickList.Items.Add(new PickListItem("Motorcycle", "Auto Insurance Policy covering collision and comprehensive loss")); pickList.Items.Add(new PickListItem("Pet", "Pet Life Insurance Policy")); pickList.Items.Add(new PickListItem("Renter", "Renter Insurance Policy covering personal loss within a rented dwelling")); // Persist the changes to the db. this.actApplication.ActFramework.PickLists.UpdatePickList(pickList); // Add Policy Type. field = new FieldDescriptor("Policy Type", "POLICY_TYPE", descriptor, FieldDataType.Character); field.AllowEmpty = false; field.Attributes[FieldProperty.Length] = new LengthAttribute(32); field.Attributes[FieldProperty.PickList] = new PickListAttribute(pickList, true, false, true, false ); this.actApplication.ActFramework.Fields.Save(field);

 

 

You can customize this to your liking before creating the plugin or...

 

If you wish to make changes after compiling you'll need some additional code to provide a way to update your picklist you've created in this segment.

This should be possible with the SDK using essentially the same code as above.

 

Hope this helps!

 

Message Edited by Carlton_Jones on 02-03-2009 05:12 PM
Carlton Jones
Sage Software