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
Nicholas FergusonNicholas Ferguson 

Unexpected Error when retrieving 'User' Layout Information

When attempting to populate the value of a User lookup field via the 'value' attribute, I receive the following error:
lookup.js:1 Uncaught (in promise) Error: LWC component's @wire target property or method threw an error during value provisioning. Original error:
[Unexpected Error when retrieving 'User' Layout Information ]
The dumbed down code looks something like this: 

html
<lightning-input-field field-name="Submitter__c" value={submitter}></lightning-input-field>

JS
import { LightningElement, api, wire, track } from 'lwc';
import Id from '@salesforce/user/Id';

export default class EditableForm extends LightningElement {
@track submitter = Id;

}

The stickler is that this code previously worked. I only found this issue when returning to this form to test an unrelated workaround (changing a manual sharing rule from a flow to a trigger).

Any idea why this is happening? 
Best Answer chosen by Nicholas Ferguson
Nicholas FergusonNicholas Ferguson
This has been resolved via Support! It turns out that in order for the user lookup field to work, users must have a 'User Profile Page Layout' assigned which apparently doesn't happen by default. Once I assigned this profile to the relevant users and added relevant fields to the layout, the user lookup field worked correctly.

It's still not totally clear (to me) why the field works without the layout assigned but only fails when a value is assigned to the field.  I hope this helps someone else in the future!

All Answers

ManiKumar Gunda 10ManiKumar Gunda 10
I think for Salesforce things we have to use wire decorator
Nicholas FergusonNicholas Ferguson
If you're thinking for the '@salesforce/user/Id' import, then to test I added a <div> next to the input field and the div populates with my user Id. So that would seem to not be true?

If not, please let me know what you meant. Thanks!
Vinay MVinay M

Hi Nicholas Ferguson,

   Is this the only code in the component. I think the error is from other part of the code where @wire is being used. Please post the whole code if there is something else in the component.

Thank you,

Vinay.

Nicholas FergusonNicholas Ferguson
Hi Vinay! 

There is more to the code. However, if I comment out '@track submitter = Id;', I get no errors (as I'm no longer setting a value to the input field). So, I know the issue is related to this. This is why I 'dumbed down' my code so it doesn't over complicate the post.
Nicholas FergusonNicholas Ferguson
This has been resolved via Support! It turns out that in order for the user lookup field to work, users must have a 'User Profile Page Layout' assigned which apparently doesn't happen by default. Once I assigned this profile to the relevant users and added relevant fields to the layout, the user lookup field worked correctly.

It's still not totally clear (to me) why the field works without the layout assigned but only fails when a value is assigned to the field.  I hope this helps someone else in the future!
This was selected as the best answer