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
alex_from_parisalex_from_paris 

New be : in a list view, get selected record in visualforce/apex

Hello

I have a simple problem

I have a list of account

I would like to select them, click on a button, a visualforce page appear with a picklist and then according to selected value, I will update all selected account with this new value

I have developed this behaviour in javascript with a prompt box instead of a picklist

Now I would like to migrate it to visualforce and I can't get the way of having Id of selected account : how do I implement my controller....

It seems to be a simple question but I did not find any doc on that

Thanks for your help on apex and visualforce side

regards

Pradeep_NavatarPradeep_Navatar

Find below a sample code for listview of  the account object  :

 

            <apex:page standardController="Account" recordSetvar="accounts">

                                                                <apex:pageBlock title="Viewing Accounts">

                                                                <apex:form>

                                                                <apex:panelGrid columns="2">

                                                                <apex:outputLabel value="View:"/>

                                                                <apex:selectList value="{!filterId}" size="1">

                                                                <apex:actionSupport event="onchange" rerender="list"/>

                                                                <apex:selectOptions value="{!listviewoptions}"/>

                                                                </apex:selectList>

                                                                </apex:panelGrid>

 

                                                                <apex:pageBlockSection >

                                                                <apex:dataList var="a" value="{!accounts}" id="list">

                                                                {!a.name}

                                                                </apex:dataList>

                                                                </apex:pageBlockSection>

                                                                </apex:form>

                                                                </apex:pageBlock>

              </apex:page>

 

               Hope this helps.

My OwnMy Own

Thanks Dude, It Really helped me alot. :smileyhappy:

alex_from_parisalex_from_paris

Hi

In fact my question was not precise enough.

In my script I want to update Account but I also want to create a custom object

So I need a controller extension instead of using "save" account standard controller

Do you have some code that could help me ?

Regards

nagalakshminagalakshmi

Hi Pradeep,

 

In the same way i need to display the account,contact,lead listviews in to one single picklist. Please help me.

 

Thanks,

Laskhmi