Lookup filter based on current user

Hello, i have two fields on my form. Person or group and Lookup. I want to filter the lookup based on current user. If I open the form it sets the current user, but the lookup is empty. If I delete the current user, than start typing the name, choose a user than the lookup is working. I am getting the data from different list to the lookup.
Do you know where is the problem? I am adding my scripts and some screenshots of settings. Thank you.


Hello @Marek,

When the Person or Group field is populated programmatically, the additional information about the user like Log in is not loaded. So setting up the filter in UI is not an option here.

In this case, you need to filter Lookup control using the code:

function filterLookup(value) {
    if(value && value.EntityData && value.EntityData.Email){
        fd.control('FilteredLookup').filter = "Person/EMail eq'" + value.EntityData.Email + "'";

        fd.control('FilteredLookup').filter = '';

fd.spRendered(function() {
    fd.control('FilteredLookup').ready(function() {
        //filter FilteredLookup when Person field changes
        fd.field('Person').$on('change', function(value){
            fd.control('FilteredLookup').value = null;

        //filter FilteredLookup when form opens
        fd.field('Person').ready(function(field) {

Please learn more in Configure lookup field filters on a SharePoint form with JavaScript article.

Hello, thank you for your explanation.
It is working fine now.