Hello,
I have a issue at the moment and I am not able to solve it.
Problem: I have 2 classes at the moment for example class A and Class B. Inside class A I have a for loop running on Accounts.
Class A{
for(Account t: listAccounts){
String abc = t.Name;
String URL = 'http://testURL.com/test?q1='+t.id+'&q2='+t.Name.......till q50';
}
}
So everytime this for loop runs on an account, it generates a new URL. I want a way to pass this URL from the for loop to another class which displays it on a VF page. So, the class B is the controller of the VF page.
The URL is going to be more than 500 characters long so its not possible to pass it as a custom setting and retrive it on the other controller.
Class B{
public String getURL(){
//Somehow fetch that URL everytime the loop runs
return URL;
}
}
Now, the VF page will call this controller class B to retrieve the URL and display it as a output link.
What I have tried: I have tried to use getters and setters but it did not work. Why? because the VF page strictly calls a getURL() method with no parameters.
I also tried to save it in a custom setting but since the length is so long it would not be possible!
Please help. Any kinds of helps will be much appreciated!
Thanks guys for the help but the only way out I could find is saving it on a custom object which has a look up on Account and then doing a SOQL to get it in the Class B.
Thanks for the help guys!