You need to sign in to do that
Don't have an account?
Related List on VisualForce page
I created a customer object called New Call Log. The call log is related to Solutions object where solutions is the parent. I am trying to create a VF page with Call log is the controller. A rep would enter in the information regarding the call and on the same page the Solution is shown below the call. I have been trying to work with sample code from the Recruiting application but it isn't working. This is what I have so far.
<apex:page standardController="New_Call_Log__c" id="thePage" showHeader="false"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons location="bottom"> <apex:commandButton value="Save" action="{!quickSave}" reRender="out, in" status="status"/> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockSection columns="1"> <apex:inputField value="{!New_Call_Log__c.Who_is_Calling__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Reason_for_Call__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Additional_Details__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Date_of_Call__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Name_of_Caller__c}"></apex:inputField> <apex:inputField value="{!New_Call_Log__c.Callers_Email__c}"></apex:inputField> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Solutions"> <apex:pageBlockTable value="{!New_Call_Log__c.solution__r}" var="JA" title="Solutions"> <apex:column value="{!JA.Solution__r.SolutionNote"></apex:column> <apex:column Value="{!JA.Soluiton__r.Incident_Reason__c"></apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Any help would be very appreciated.
Ohh so there is a New_Call_log__c lookup field on the Solutions object? In that case your first try was close. What you should do, is goto the Solution object in setup. Goto the lookup custom field. You should see something called "Child Relationship Name" Thats what you want to use. When I created a lookup field to an object on Solution, it created a relation name of "Solutions" So in your first example it whould have been
Hopefully that will fix it. Sorry that I misunderstood the first time.You made it clear when you said "Solutions is the parent."
All Answers
It would help to know why it isn't working. But I am going to guess it is this part of you code.
Try this.
Hope that works
I have tried it both ways with and without the Solution__r after the JA.
This is the error I get:
The field that links the two is Possible_Solutions__c.
Lookup Options:
What is the field name on New_Call_Log__c and is it a lookup? If it is Possible_Solutions__c then use that as your value.
value="{!New_Call_Loc__c.Possible_Solutions__c}"
If it is not a lookupfield on the New_Call_Log__c then you will have to do it a different way.
I have tried the following and still come up with an error code.
<apex:pageBlockTable value="{!New_Call_Log__c.Possible_Solutions__c}" var="JA" title="Solutions"> <apex:column value="{!JA.SolutionNote}"></apex:column> <apex:column Value="{!JA.Incident_Reason__c}"></apex:column> </apex:pageBlockTable>
Possible_Solutions__c is a look up field on New Call Log object that links the object to Solutions object.
With the code above I get this error
But it is a field in the object New Call Log.
Hmm, because I did a quick test in a de org, creating a New_Call_Log__c object and a Solution__c object. Gave New_Call_Log__c a lookup to Solution__c. And the code worked fine.
Are you sure its not Possible_Solution__c instead of Possible_Solutions__c
You are right. I have been staring at the code for too long. I didn't even catch that because I always try to copy and paste the name of the field. Now I am getting a new error.
<apex:pageBlockTable value="{!New_Call_Log__c.Possible_Solution__c}" var="JA" title="Solutions"> <apex:column value="{!JA.SolutionNote}"></apex:column> <apex:column Value="{!JA.Incident_Reason__c}"></apex:column> </apex:pageBlockTable>
The error I get is:
Thank you for all your help so far. I am at point where I just can't look at it anymore and need a fresh set of eyes.
Rachael
lol No Problem. Trust me I know how that is. Since it is a custom object I am assuming it is a custom field. Try this
JS.SolutionNote__c
Hope that works
Ohh so there is a New_Call_log__c lookup field on the Solutions object? In that case your first try was close. What you should do, is goto the Solution object in setup. Goto the lookup custom field. You should see something called "Child Relationship Name" Thats what you want to use. When I created a lookup field to an object on Solution, it created a relation name of "Solutions" So in your first example it whould have been
Hopefully that will fix it. Sorry that I misunderstood the first time.You made it clear when you said "Solutions is the parent."
Well you sort of got it. I had a look up field called Possible_Solution__c on the custom object "New Call Log". Possible_Solution__c is a Master Detail look up field linked to "Solutions" object where "Solutions" is the Parent. Making Possible_Solution__c the child. I tried to add a field onto "Solutions" where New Call Log is the Parent and Solutions is the child. I used that field "Call_Log__c" but it didn't work.
After I created the new field and retried my original code, it finally worked. Now I am having another issue. The columns are not working. I tried the original code for the columns and different code I found but neither work. Here is what it looks like:
apex:pageBlock title="Solutions"> <apex:pageBlockTable value="{!New_Call_Log__c.Possible_Solution__r}" var="JA" title="Solutions"> <apex:column> <apex:facet name="Solution Title"> <apex:outputText value="SolutionNote"></apex:outputText> </apex:facet> </apex:column> <apex:column value="{!JA.SolutionNote}"></apex:column> <apex:column Value="{!JA.Incident_Reason__c}"></apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
What do you mean "The columns are not working?" Error? No data?
The only thing I see wrong with your code is your facet. I'm not sure what you are trying to do, but the only two values a facet name can have are "header" and "footer".
Did you create any records? In other words, is Possible_Solution__r empty?