You need to sign in to do that
Don't have an account?
Wiz76
Populating Parent Record on New VF Page
Hoping for some help here...I have never done VF development before but I wanted to give it a shot in some prototyping I am doing for a project.
I have an Object (Underwriting__c) which I have created to track our underwriting process. I am building a simplified approval process so I have created a child to trakc these (Approval_history__c). I would like to have a button on the detail page of the underwriting layout take me to a custom VF page to select the next approver, but I am having problems being able to populate the Underwriting__c parent field on this new VF page.
I have read many posts and tried a lot of their code to make this work but I just can't get it to populate when clicking the button from the Undewriting page. Hoping for some help in any way. I know it involves a controller extension but all the ones I have tried on this board do not help.
Here is my page so far:
<apex:page standardController="Approval_History__c">
<apex:form >
<apex:pageBlock title="Choose Next Approver">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField required="TRUE" value="{!Approval_History__c.Next_Approver__c}"/>
<apex:inputField required="TRUE" value="{!Approval_History__c.Underwriting__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
The goal would be to substitute {!Approval_History__c.Underwriting__c} with the name or Id (not sure which because the name is what needs to populate when using a URL hack). So the only thing they need to choose is the next approver. I am trying to shy away from the URL hack because I only want them to have the ability to save, not save & new or cancel.
Thanks!
I have an Object (Underwriting__c) which I have created to track our underwriting process. I am building a simplified approval process so I have created a child to trakc these (Approval_history__c). I would like to have a button on the detail page of the underwriting layout take me to a custom VF page to select the next approver, but I am having problems being able to populate the Underwriting__c parent field on this new VF page.
I have read many posts and tried a lot of their code to make this work but I just can't get it to populate when clicking the button from the Undewriting page. Hoping for some help in any way. I know it involves a controller extension but all the ones I have tried on this board do not help.
Here is my page so far:
<apex:page standardController="Approval_History__c">
<apex:form >
<apex:pageBlock title="Choose Next Approver">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputField required="TRUE" value="{!Approval_History__c.Next_Approver__c}"/>
<apex:inputField required="TRUE" value="{!Approval_History__c.Underwriting__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
The goal would be to substitute {!Approval_History__c.Underwriting__c} with the name or Id (not sure which because the name is what needs to populate when using a URL hack). So the only thing they need to choose is the next approver. I am trying to shy away from the URL hack because I only want them to have the ability to save, not save & new or cancel.
Thanks!
The syntax to get the Underwriting record is not '{!Approval_History__c.Underwriting__c}'
It should instead be something like '{!Approval_History__r.Underwriting__c}' , because it is a relationship that we are getting it from. '__r' is the syntax for relationships. Again it depends on the relationship name. When you created the lookup field on the approval history object, you must have given a relationship name. That relationship name should be used here. for example, if the relationship name is 'Approval_Historys', then the syntax would be '{!Approval_History__r.Underwriting__c}'
Thanks,
Shashank