You need to sign in to do that
Don't have an account?
Custom VF Button, Custom Controller?
Again, I think the answer is "No", but I want to make sure. I want to add a custom VF button to a standard layout. (I want this button to be conditional, and would have used an S-Control if they weren't going away.) I want to add this button to many different standard layouts. I want to use a custom controller with this button and, as far as I can tell by reading the doc, I cannot use a standard controller and a custom controller at the same time. Also from the doc, I am required to use a standard controller.
Please note that I want to use the SAME VF button on multiple layouts, including standard and custom objects.
Is this possible? And if this is possible, how can I do it?
TIA,
John
This worked:
public class genericStdControllerExtension { private final SObject obj; public genericStdControllerExtension (ApexPages.StandardController cntrl) { this.obj = cntrl.getRecord(); } public String getId() { return 'Id: ' + obj.get('Id'); } public String getType() { return 'Type: ' + obj.getSObjectType(); } }
Now that I have the object ID and type, I can create programmatic relationships without having an underlying object relationship.
All Answers
OK, I tried that. Since I want to be able to extend ANY standard controller, I tried this:
public class genericStdControllerExtension { private final SObject obj; public genericStdControllerExtension (ApexPages.StandardController cntrl) { this.obj = cntrl.getRecord(); } public String getStdId() { return 'Id: ' + obj.id; } }
All I really want is the ID of the object. Once I have that, I can implement my custom logic and all's well.
Problem is, I get this error message:
Is the error in my code, or am I trying to do something impossible?
TIA
John
This worked:
public class genericStdControllerExtension { private final SObject obj; public genericStdControllerExtension (ApexPages.StandardController cntrl) { this.obj = cntrl.getRecord(); } public String getId() { return 'Id: ' + obj.get('Id'); } public String getType() { return 'Type: ' + obj.getSObjectType(); } }
Now that I have the object ID and type, I can create programmatic relationships without having an underlying object relationship.
XXX,
What do your VisualForce pages look like in this case?
Is there anyway to have just one VisualForce page that is used on a Lead, Opportunity, Case, etc, but still leverage the data in their respective standard controllers?
Thanks,
Jon