You need to sign in to do that
Don't have an account?
Lorant Dobrondi
Create Opportunity related record in Visualforce page
Hi!
I have a Master-Detail relationship between my custom object and the Opportunity built-in object.
I would like to be able to create a record of my custom object from the Opportunity record via a visualforce page, but i'm not sure how to achieve this.
If I use the standardController as Opportunity, the visualforce page shows up in the page layout builder, but obviously, the code is not working.
Here's the visualforce page:
<apex:page standardController="CFA__c"> <apex:sectionHeader title="CFA Edit" subtitle="{!CFA__c.Name}"/> <apex:form id="CFA_Edit_Form"> <apex:pageBlock title="CFA Edit" mode="edit"> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> <apex:commandButton value="Save & New" action="{!save}" /> <apex:commandButton value="Cancel" action="{!cancel}"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Information" columns="2"> <apex:inputField value="{!CFA__c.Name}" required="true"/> <apex:inputField value="{!CFA__c.Type__c}" required="true"> <apex:actionSupport event="onchange" reRender="CFA_Edit_Form" /> </apex:inputField> <apex:inputField value="{!CFA__c.AE__c}" rendered="{!CFA__c.Type__c == 'Joint Visit'}" /> <apex:inputField value="{!CFA__c.AE_Description__c}" rendered="{!CFA__c.Type__c == 'Joint Visit'}" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Any way this is achievable with Visualforce?
Lorant Dobrondi
PS: If I simply preview this visualforce page, it runs well, but I can't add it to the Opportunity page layout.