You need to sign in to do that
Don't have an account?
john8407
Multiple objects in Visualforce page
I have a visualforce page that shows fields from multiple objects. I noticed that when I try to save, it is not saving to the other child objects. Anyone know how to make this happen?
I would assume that if you are using the standard {!save} function it is only saving the information related to the standard controller.
To save across multiple objects, you will need to create a custom save function. In that functions:
1. I assume you already have the specific lists related to each object defined and are using <apex:inputfield> to get the input from the user, or <apex:outputField> and allowing editing??
2. In the custom save function insert or upsert as appropriate.
Posting your code may help to better understand what you are trying to accomplish
All Answers
I would assume that if you are using the standard {!save} function it is only saving the information related to the standard controller.
To save across multiple objects, you will need to create a custom save function. In that functions:
1. I assume you already have the specific lists related to each object defined and are using <apex:inputfield> to get the input from the user, or <apex:outputField> and allowing editing??
2. In the custom save function insert or upsert as appropriate.
Posting your code may help to better understand what you are trying to accomplish
starz...Do you know what I have wrong here? It's modifying the record but not saving anything to it.
public class ABCcontrollers{
ApexPages.StandardController controller;
Public ABCcontrollers(ApexPages.StandardController stdController) {}
public void saveabc()
{
String sId = ApexPages.currentPage().getParameters().get('id');
ABC__C ab = [SELECT Id FROM ABC__c WHERE Id= :sId];
if (ab != null) {
update ab;
}
}
}
I would assum that you are noe getting the new sow data from the record, you select pulles data from the database but what was entered on the page has not be committed yet???
Here is what I did on my form:
It's a page that pulls from 8 different objects. It's already created and when I enter data in the fields and save with the code I posted, it doesnt post to the record, but the last modified date is updating. So I'm not sure what I have wrong?
Do you know how I would do this for Update?