function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MikeMcAllisterMikeMcAllister 

Dynamically populate apex:selectList from Community's valid Categories for an Idea.

My challenge is understanding the data relations to be able to write a SOQL query to pull records that are the valid Categories assigned to a Community for Ideas created in a Community.

 

Has anyone 'out there' already done this and would be willing to share a code snippet of the SOQL query?

 

I don't have a problem with the Apex code to create the List<SelectOption> and assign it as the value of the <apex:selectList>. I just cannot seem to figure out the data relations between Community, Idea and Category.

 

Thanks in advance to anyone that can help.

 

Here's snippet of the UI definition. It might with understanding what I'm trying to do:

 

                     <apex:outputPanel >
                        <apex:selectList style="height: 340px" value="{!InternalCategoriesSelected}" multiselect="true">
                            <apex:selectOptions value="{!InternalCategoryItems}"/>
                        </apex:selectList>
                    </apex:outputPanel>
                    <apex:outputPanel >
                        <apex:selectList style="height: 340px" value="{!CustomerCategoriesSelected}" multiselect="true">
                            <apex:selectOptions value="{!CustomerCategoryItems}"/>
                        </apex:selectList>
                    </apex:outputPanel>

 

I'm trying to dynamically populate the "InternalCategoryItems" and "CustomerCategoryItems" lists with Category values based on the results of a SOQL query that pulls the valid Categories for those two Communities.

 

--Mike McAllister

 

Suresh RaghuramSuresh Raghuram

if you have eclipse or apex explorer .

 

In eclipse go to schema there it is easy to find the relation ships and you can also frame the querys easily.

 

If you did not have above said you can also check for the relation ships as follows.

 

your Name -> App setup ->Schema builder

 

If this answers your question please make this as a solution

MikeMcAllisterMikeMcAllister

This is a partial answer; but unfortunately my question is specific to the schema of the objects I mention in my question.

 

The schema of Community does not contain any fields for Category. The relationship between the valid Categories for a Community is somehow tied to an Idea object and I cannot seem to find the relation by looking at the schema of either. Somehow, there must be "user setup/data" that is defining the relationship in an invisible, or at least difficult to see, manner.

 

Since specific objects are involved in my question is there a better place or way to pose the question?

 

Thanks very much for your help.

 

--Mike McAllister

benito dardobenito dardo

Mike, did you find a solution for this, because I'm facing a similar issue.

Thanks.

Mike McAllister.ax1393Mike McAllister.ax1393

Unfortunately, I have not found a soution at this point.

 

--Mike McAllister