function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
arun Bikkasaniarun Bikkasani 

i want to filter related records

i have Postion and candidate object in my application candidate having status picklistfiled values are 
selected,Rejacted. i want to filter the selected records and rejected records for the position for that 
record pagelayout how ito achieve this help me   
 
Ahmad J. KoubeissyAhmad J. Koubeissy
create two list views. one for selected and another for rejected. you can specify the criteria based on the status field
Muhammad WasimMuhammad Wasim
The simplest and visual solution to this is to create view from the main page of your candidate object. Under the criteria section all you have to do is to provide the condition where status isequalto selected. And name that view selected candidates. Repeat for the rejected and change the condition to status isequalto rejected and name this view as rejected candidates.

If you want to achieve this with triggers let me know. 
arun Bikkasaniarun Bikkasani
Hi Wasim,

Thanks for reply. but i want the solution for position object when even i selected position record in position object in related list i want fiter the selected and rejected records
 
Ahmad J. KoubeissyAhmad J. Koubeissy
You can create two VisualForce pages, one page to show the selected and another one to show the rejected, then you add these two VF pages as a section on the position object layout.

Kindly refer to this link :

http://sfdcsrini.blogspot.com/2014/05/how-to-create-visualforce-related-list.html

In the query of each controller, specify the WHERE CLAUSE of the query, so in the first controller it will be "Where status__c = 'Selected'", and in the second controller "Where status__c = 'Rejected'".

If you find that this answer solves your problem, please mark it as Best Answer.

Thank you
Muhammad WasimMuhammad Wasim
Hi Arun

You need to follow the following steps if you want to have such related lists.

1. Create two lookup fields on your job application object linked to the position object, and name them as Accepted job application and Rejected job application. There is no need to show them on the page layout.
2. You'll probably have the status picklist field on your job application object which have the values hired and rejected.
3. Now you need to go to the process builder and create a process which will do the rest of the magic. 

I'm attaching the screen shots so that you can visualize what's going on, I hope this will make sense to you. 

1. Step1

2.User-added image

3.Step3

4.Step4

Now to test the related list functionality just update the status picklist of each position and you can see that job applications will be updated into the relvant related lists on the position object.