Populate field with user profile informations

Hello,
I read a lot of topic about this,
but in my case I think is little bit different.
I have a sharepoitn site where I invited external users (guest), and these users must be upload in the list their informations/documents.
I want that my forms retrieve their profile informations and populate the fields, but if I try to run form with my internal user no problem, while when my guest try i have this error in console:

This is the code:

function updateCurrentUserInfo() {
    pnp.sp.profiles.myProperties.get().then(function(result) {

        var props = result.UserProfileProperties;
        console.log(props);

        for (var i = 0; i < props.length; i++) {

            switch (props[i].Key) {
                case 'FirstName':
                    fd.field('Title').value = props[i].Value;
                    break;

                case 'LastName':
                    fd.field('Supplier_x0020_Code').value = props[i].Value;
                    break;
            }
        }
    });
}

fd.spRendered(function() {
    //executes updateCurrentUserInfo on form load
    updateCurrentUserInfo();
});

This is the console error:
console_error

How I can solve this issue?
Thank you.

Dear @stefano.mazzi,
Most likely there are no user profiles created for external users, so there is simply no place to retrieve this information from.

Though you can try changing permissions for external users to see if it would help:

More on that here - Collaborate with guests in a site | Microsoft Docs

Hello @Nikita_Kurguzov ,
the error was about a permission on a lookup field where the user didn't have access.
My mistake, sorry.
Thank you.

1 Like