You need to sign in to do that
Don't have an account?

Custom button on Lead List View
I am facing a small problem with custom button and VF Page.
Scenario
We would like to replace the standard button called Change Status on lead list view to add more fields. This is done but when i click on the new button it doesnt check if we have selected any record on the list view therefore a validation is required, if atleast one record is selected. I placed a java script which works fine with one record but fails when multiple records are selected.
here is the java code
java.lang.IllegalArgumentException: id 00Q550000022tMl,00Q550000022tS9 must be 15 characters
Can somebody please help?
A
Scenario
We would like to replace the standard button called Change Status on lead list view to add more fields. This is done but when i click on the new button it doesnt check if we have selected any record on the list view therefore a validation is required, if atleast one record is selected. I placed a java script which works fine with one record but fails when multiple records are selected.
here is the java code
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} var ids = {!GETRECORDIDS($ObjectType.Lead)}; if(ids.length > 0) { window.location='../apex/Lead_Status_Change?ids='+ids; } else { alert("No Row Selected"); }
java.lang.IllegalArgumentException: id 00Q550000022tMl,00Q550000022tS9 must be 15 characters
Can somebody please help?
A
All Answers
The control is reaching your Lead_Status_Change VF page from the button. Once the control is there, I am thinking, you are tying to create an insteance of ID object in your controller. That is failing because as part of your URL parameters, your have "00Q550000022tMl,00Q550000022tS9" as id.
What you need to do is, in controller split the string "00Q550000022tMl,00Q550000022tS9" using comma as delimited and try creating multiple ID objects for each of the splits, instead of one ID record for all of them
Hope this helps.
thanks for your reply, here is my VF Page Code
In this case, you can consider one of the two possible solutions:
1. Make sure you send only one id to the VF page from your button.
2. Create a custom controller to handle multiple ids which are part of the "id" URL parameter.
I suggest option 2 as option 1 may not meet your business needs.
I have updated your VF page with a new controller. See if it helps
custom controller should look like:
I believe i am very near to the solution but this is the error i am getting on VF Page
Error: No standard controller was specified - recordSetVar cannot be used.
I removed recordSetVar="leads" and was able to save the VF page but now i am getting this erro
System.NullPointerException: Attempt to de-reference a null object
Class.MyTestApexClass1.<init>: line 6, column 1
to
Notice how the new code has the GETRECORDIDS dereferencing inside two single quotes.
this doesnt make any difference but code is throwing this error at the time of updating status
Visualforce Error
Help for this Page
System.DmlException: Update failed. First exception on row 0 with id 00Q550000022tMlEAI; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Please enter a value for Industry Verified by field.: []
Error is in expression '{!Save}' in component <apex:commandButton> in page lead_status_change: Class.LeadStatusChange.save: line 13, column 1
Class.LeadStatusChange.save: line 13, column 1
Now you are having your application specific issue and not related to technology. You have to check with your business how to proceed and if required you will have to capture the "Industry Verified By" field in your VF page for taking in the data from user.
You may mark the my earlier response as a solution to the problem you were facing. tc.
I found that there are some validations throwing errors - i will take care of that, my last thing form you is when i land on the VF page if shows the rows for each selected lead on the list view, is there any way we can get only on row to change status of all the leads? otherwise, what's the point of selecting multiple leads?
thanks for all the efforts and help, everything works fine excepts the redirection after clicking save, how can i redirect to the same list view?
thankyou very much once again