3

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:

enter image description here

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>
8
  • Can you add more details like user licence type? is it communites? Is it for all objects or just standard object? objectApiName is dynamic , is it possible for it to be wrong , or someone prvided wrong input? – Pranay Jaiswal Aug 11 '19 at 19:33
  • Its Opportunity, and normal app (added in question). While loading in read/view mode itself, getting this error. – salesforce-sas Aug 11 '19 at 19:38
  • I feel it's related to some fields? Can you just have a single field Name in input and see if it works? – Pranay Jaiswal Aug 11 '19 at 19:50
  • More like, user have access to those field(lookup), but no access to the lookup object /record. – Pranay Jaiswal Aug 11 '19 at 19:57
  • It's actually just date time fields. But I will try that and see. Thanks for suggestion – salesforce-sas Aug 11 '19 at 20:05
1

Make sure you kept all the fields on the layout which you have referred in your lightning component. It was working for me.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.