You need to sign in to do that
Don't have an account?
SamuelRobert
How to bring in lookup filter functionality in VF page
Hi there are two lookup fields one is Group__c and Site__c the lookup filter for Group__c is : (Group: TypeEQUALSGROUP-PNET) AND (Group: Parent Account IDEQUALSOrder: Account Name ID)
Site__c:(Site Name: TypeEQUALSSITE-PNET) AND (Site Name: Parent Account IDEQUALSOrder: Group ID)
We have Account with few Hierarchy, there is Field called Type. If Type = Customer then it is head for the Account that has the Type = GROUP-PNET the Account that has GROUP-PNET type will have the Parent Name(lookup) as Account name or ID of the the Account with Type= Customer.
2nd Scenario: We have another Account Type = SITE-PNET. these Account will Comes under the Account Type= "GROUP-PNET" hence the parent Name of the Account Type= SITE-PNET will have the Account name or ID of the Account type which is = GROUP-PNET.
Already Order object by default has a Account lookup field,Based upon the above scenarios the Filter is set up.
Now this is working fine in the order edit and detail page. I want this to be available in the VF page and i tried few logic which did not worked out for me.
VF::
APEX:
Site__c:(Site Name: TypeEQUALSSITE-PNET) AND (Site Name: Parent Account IDEQUALSOrder: Group ID)
We have Account with few Hierarchy, there is Field called Type. If Type = Customer then it is head for the Account that has the Type = GROUP-PNET the Account that has GROUP-PNET type will have the Parent Name(lookup) as Account name or ID of the the Account with Type= Customer.
2nd Scenario: We have another Account Type = SITE-PNET. these Account will Comes under the Account Type= "GROUP-PNET" hence the parent Name of the Account Type= SITE-PNET will have the Account name or ID of the Account type which is = GROUP-PNET.
Already Order object by default has a Account lookup field,Based upon the above scenarios the Filter is set up.
Now this is working fine in the order edit and detail page. I want this to be available in the VF page and i tried few logic which did not worked out for me.
VF::
<table> <tr> <td colspan="3" style="text-align:left;width:100px!important;font-weight:bold;font-size:12px;color: #4a4a56;padding-right: 2px;"> <apex:outputLabel value="Group" for="lookup"/> </td> <table> <apex:inputField value="{!order.Group__c}" label="Group" id="grp"/> <apex:actionSupport event="onchange" action="{!grouplookup}" reRender="siteinfo"/> </table> </tr> </table>
APEX:
public NewOrderController() { Order order = new Order(); order.Group__c = accts.ParentId; accts=[select Id,ParentId,type,AccountNumber from Account where type='GROUP-PNET' and Id =:accts.ParentId]; } public pageReference grouplookup() { accts = [select Id,ParentId,type,AccountNumber from Account where Id=:order.Group__c]; return null; }
I recently encounter a problem I believe to be similar, where a lookup filter was showing no records on a visualforce page. You can look at the related question here(http://salesforce.stackexchange.com/questions/142579/lookup-with-filters-fails-to-display-records-on-visualforce-page).
Hope this helps.
Best Regards,
Nagendra.P