Problem: Many users are able to see a form but few users are not able to see the form and getting error [object object]
.
I am using lightning:recordEditForm
as below in lightning record page:
<lightning:recordEditForm aura:id="form" recordId="{!v.recordId}"
objectApiName="{!v.objectName}"
onerror="{!c.handleFormError}"
onsuccess="{!c.handleFormSuccess}">
<!-- the messages component is for error messages -->
<lightning:messages />
// lightning:inputField
While testing for different users, its working for most of the users but failing for very few users and getting UI like below:
When trying to debug (with breakpoint) the event
from method handleFormError
, I am getting below in console logs
event.getParam('message') "Cannot read property 'errorCode' of undefined" event.getParam('detail') "" event.getParam("output").fieldErrors undefined JSON.stringify(event.getParam('output')) "{}" JSON.stringify(event.getParam('error')) "{"ok":false,"status":400,"statusText":"Bad Request","body":{}}"
Further, I am getting below error in console log after the record page is loaded.
KB {component: "markup://force:lds", componentStack: "[lightning:recordEditForm]", action: null, name: "AuraFriendlyError", message: "Error in fetching record or record metadata. [[object Object]]", …}
For the user, for his profile, all the fields used in form have editable
permission for that specific record type and has access to record. App is normal (non-console). Object is Opportunity (and its custom fields).
PS: Pls let me know if any other info has to be added in question. Thanks in advance!
----------------------- EDITED ---------------------------------------
Event for very simple form like below, I am getting error for this user:
<lightning:recordEditForm recordId="{!v.recordId}"
objectApiName="Opportunity">
<lightning:messages />
<lightning:outputField fieldName="Name" />
</lightning:recordEditForm>
objectApiName
is dynamic , is it possible for it to be wrong , or someone prvided wrong input?Opportunity
, and normal app (added in question). While loading in read/view mode itself, getting this error.Name
in input and see if it works?