My requirement was to create in a Custom Object two picklist fields, one of them being dependent of the other i.e. I needed to restrict the values of Menu2, based on the value selected in Menu1.
First step is to create two Menu-Only custom objects:
- Go to Database > Object Designer open package CO
- Click New on the ribbon and chose Menu Only Object
- Give a name to the Menu-Only Custom Objects and add the values (values can be then added/updated through the Customizable Menus)
I created CO.Menu1, with values “Language” and “Employment Status”
I created CO.Menu2, with values “English”, “French”, “German”, “Part Time”, “Full Time”, “Unemployed”.
Second step is to create two fields, type Menu in my Custom Object:
- Select your Custom Object and choose the Fields tab (on the ribbon)
- Click Add New Field button and choose Menu type
- Give a Name to the field
- Choose CO.Menu1 (or CO.Menu2) from the Menu Field Settings
After all these changes on the Object Designer, save and deploy (buttons on the ribbon).
Third step is to add the two fields to the workspace:
- Go to Application Appearance > Workspaces and open your workspace
- Click the Insert Field tab on the ribbon and drag the two new fields to the workspace
Fourth step is to create the Rules:
- Click the Rules tab on the ribbon and click Add Rules
- Create the following two rules:
If Menu1 = “Language” then set Menu2 to include “No Vale”, “English”, “French”, “German”
– Trigger = Apply this rule when a field changes (field “Menu1”)
– Condition = But only if a field as a certain value (Menu1 equals “Language”)
– Then = Set menu field to include menu items (Menu2 to include “No Vale”, “English”, “French”, “German”)
If Menu1 = “Employment Status” then set Menu2 to include “No Value”, “Part Time”, “Full Time”, “Unemployed”
– Trigger = Apply this rule when a field changes (field “Menu1”)
– Condition = But only if a field as a certain value (Menu 1 equals “Employment Status”)
– Then = Set menu field to include menu items (Menu2 to include “No Value”, “Part Time”, “Full Time”, “Unemployed”)