You need to sign in to do that
Don't have an account?
Jason Dunphy
Visualforce - New Case Page, Related Contact Input Dependent on Account Input field
Hoping someone might be able to help me out or at least streamline my research and point me to the right direction as I’m not really making quick progress. I'm just learning apex and visualforce, looked around this forum and the docs, and just can't seem to find an example that matches my scenario.
I have a visual forcepage that will pop from the CTI and create a NEW case. All I’m looking to do is make the contact input field dependent on the account input field that the user selects and then submit those to a new case. This will be used when a contact or account match can't be found from the ANI passed in by the CTI.
The bare bones:
What is the best way to do this, SOQL in an extension? I’ve pieced together some code and sample which returns some related contact vales of related contacts, but I'm not thrilled about the UX and it seems to also be breaking my save command. I really just want it to be another pick list style input field.
Any help or guidance would be greatly appreciated.
Thanks
I have a visual forcepage that will pop from the CTI and create a NEW case. All I’m looking to do is make the contact input field dependent on the account input field that the user selects and then submit those to a new case. This will be used when a contact or account match can't be found from the ANI passed in by the CTI.
The bare bones:
<apex:page sidebar="true" StandardController="Case" extensions="sampleExtension"> <apex:form > <apex:pageBlock title="Create A New Case"> <apex:pageBlockSection title="My Case" columns="2"> <apex:inputField value="{!Case.AccountId}" <apex:inputField value="{Case:ContactId}" <apex:inputField value="{!Case.Description}"/> </apex:pageBlockSection> </apex:pageBlock> <apex:commandButton action="{!save}" value="Save" id="theButton"/> </apex:form>
What is the best way to do this, SOQL in an extension? I’ve pieced together some code and sample which returns some related contact vales of related contacts, but I'm not thrilled about the UX and it seems to also be breaking my save command. I really just want it to be another pick list style input field.
Any help or guidance would be greatly appreciated.
Thanks
I guess if you apply lookup filter on the Case.Contact will help you out.
Just try to edit you contact field on the Case and create a lookup filter. Please refer the below screenshot for better understanding.
Please tell me if it doesn't help you.
If it does say Cheers :)
Thank you for the suggestion. I was also hopping the filter on the lookup field would solve this. The problem in my case with that is that it only auto-dispalys recent contacts and users need to search to find hits. Screenshot below is the results, my hacked code pulls in the related contacts on the bottom left based on account. And the Contact Name search doesn't show any results.
For more detail, here's what I'm currently using, but don't like as it's not great if many contacts are found and I haven't figured out how to actually save a new case with the contact associated with the check box. And the Apex Class.
Thanks,
Jason
"The problem in my case with that is that it only auto-dispalys recent contacts and users need to search to find hits."
This is not a problem, this is the expected behaviour of salesforce.
And may be you have not configured your filter properly so you are not able to see the contacts otherwise it would have been working.
Could you please post a screenshot of your lookup filter?
The search does return only contacts related to the account selected when the search is executed, but only shows recent contact (based on Accout ID) when they first open the search page. What I was hoping to do was have the contact input field show related contacts before user executes the search.