You need to sign in to do that
Don't have an account?
Srikanth sfdc 32
Split Method in apex class
How to get the multiple ids from the url through split method in apex class .. can anyone help me out from this scenario
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Use Like:
Thanks
Hi Srikanth,
Pass multiple ids in URL as below (semicolon separated, Or you can use your separator use the same when splitting).
/apex/YOUR_PAGE?ids = XXXXXXXXXX;XXXXXXXXYY;DFDFDFDFDRXX;
the get the url parameter in a variable using ApexPages.currentPage().getParameteres().get('ids');
lets say you took into below variable.
Then split the allIds using split method of String class see below.
If your ids are coming with different url parameters i.e. /apex/YOUR_PAGE?id1 = XXXXXXXXXX&id2=XXXXXXXXYY&id3=DFDFDFDFDRXX;
Hope that will resolve your queries.
Thanks!
Ashif
public class DisplaySelectrecords
{
public ApexPages.StandardController setCon;
public list<Opportunity> opptlist{set;get;}
public opportunity opp {set;get;}
public opportunity oppt {set;get;}
public list<string> oppids{get;set;}
public string id{get;set;}
public DisplaySelectrecords(ApexPages.StandardController controller)
{
setcon = Controller;
this.oppt = (Opportunity)controller.getrecord();
oppIds = ApexPages.currentPage().getParameters().get('id').split(';',-2);
opptList = [select id,name,Amount,closedate from opportunity where id IN:oppids];
}
}
Note : I am getting Error : Attempt to dereference a null object In the line of Split();
Try as
Regards
Ashif
String allIds = ApexPages.currentPage().getParameters().get('id');
oppIds = allIds.split(';');
Can you please share your URL?
So That I can make sure my code is fit in your requirement or not.
Regards
Ashif
I have list Button on Opportunity Object when ever i selected the records and click on this list button it will redirect to the vf page . In vfpage it will show only selected records.
can u try the code..
I created a list view button on Account Object
I created a list view button as TestButton1 and added VF page AccountList
Then added TestButton1 in List View of Account And select 2 Account Record Then click on button
It will populate Selected Account On VF Page
AccController.apxc
AccountList.vfp
You Don't need to split ID
I hope this is the solution to your question If it works, close the question as best.
Regards
Ashif