RE: Dynamic lookup filter based on logged in user account
Hi Indra,
If I understood your requirement correctly,
- Here, School information you are storing in Account (or might be any custom entity) Entity.
- Student information you are storing in Student Entity.
- Each Student has a contact in CRM in order to log onto the Portal.
- You want, if any student login to the portal, he/she should be able to see the students of his/her school in any custom lookup field.
What you can do is:
Assuming you already have done this-
- On Contact entity, keep one lookup field of School (ignore if already having) in order to store School Information.
- On Student entity, keep one lookup field of School (ignore if already having) in order to store School information.
- Keep two Lookup fields ('Logged In Contact School' and 'My School Students') on the form that you are exposing on the portal to show the filtered students.
- Enable lookup filtering on the 'My School Students' lookup in CRM - To view only those students record where Selected School record in 'Logged In Contact School' equals to all those students of Student entity who belongs to that school.
or in easy language
Lookup Filtering Condition would be:
Show only those Students in 'My School Students' lookup, where School field value of the Student record = School field value in 'Logged In Contact School'
In below example, we are filtering contacts based on Account. In the same way, you have to filter Students based on School.
- This will give only those students in 'My School Students' lookup which is equal to school selected in 'Logged In Contact School'
- Now the interesting part is, how we would get Logged In Portal user (Student's) School name. For this, we will use Entity Form Metadata.
- In 'Logged In Contact School' field auto-populate logged In Portal user's School using Entity Form Metadata. We are already keeping School information on each Contact record.
- So this way, when you open form on the portal - each portal logged in user's school will get auto-populated automatically in 'Logged In Contact School' field and your 'My School Students' lookup will have only logged in student's school's students.
You can refer below link to see how we can auto-populate Portal Logged In user information on entity form
https://community.dynamics.com/crm/f/117/t/254468
http://dynamicscrmcoe.com/how-to-auto-populate-field-adxstudio-entity-form/
Mark, it verified, If you are able to understand the solution of your requirement.
Cheers
Arpit
https://arpitmscrmhunt.blogspot.in