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
TiborMTiborM 

List view button - don't want to open visualforce page when selection is empty in list view

Hi,

 

i have list button in CASE object which Open visualforce page and have enabled Display checkboxes for muli-record selection.

 

I want to make some javascript for this button or some code for page which:

 

1. show alert and block all controls on page with standard CASE Button controller so user must click BACK in navigation

 

OR

 

2. Show alert windows when user click on list view button and there is no selection and after this alert will be no redirect to VF page

 

 

How Can I do it?

hisrinuhisrinu

In this case first you need to use on click javascript on that button.

 

You have verify whether the user has selected any records or not in script. If user selects then navigate him to page else show an alert

TiborMTiborM

ok show alert in javascript is no problem... but how to redirect to Visualforce page and send to this page selected items in list view??

Naveed AnwarNaveed Anwar

Hey,

 

Have you done this?

i need to do exactly the same...

 

Can you help in javascript and VF Page code to check that how many records has been selected and then on VF Page getting list of those records ?

hisrinuhisrinu

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var records = {!GETRECORDIDS($ObjectType.Account)};
var newRecords = [];

if (records[0] == null)
{
alert("Please select at least one record")
}
else
{
window.location.href="/apex/mapage";
}

 

 

KPGUPTAKPGUPTA

hello ,

 

Thanx for your code .. it works.. but i want to change a little thing in this.. instead of redirecting this page on other vf page i want to show the selcted record on clicking this button.. can you please tell me how can i do this....