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
Artem Kalus 7Artem Kalus 7 

lightning-record-edit-form Unable to find the record referenced by (ObjectName).OwnerId in null:

I have a publicly available page through salesforce sites. It was working before our sandbox got upgraded to Spring 2020 release. In order to replicate the problem a salesforce site needs to be created. The LWC will be embedded within salesforce site VFP.

I gave the external user access to Case object (read/edit) and visibility of fields to be displayed.

I get identical issue with aura component "lightning:recordEditForm" and LWC "lightning-record-edit-form".

I could replace the lightning-record-edit-form with input fields, however, it makes things complicated with dependent picklists.


VFP:
<apex:page standardStylesheets="false" applyBodyTag="false" sidebar="false" showHeader="false">
    <apex:includeLightning />
    <div id="container"></div>
    
    <script>
    $Lightning.use("c:Site_LWC_Viewer_App", function()
    {
        $Lightning.createComponent(
            "c:testLWC",
            {'greeting':'Somnath'},
            "container",
            function(cmp)
        {
            console.log('component created');
        });
    });
    </script>
</apex:page>

AURA APP - "Site_LWC_Viewer_App":
<aura:application extends="ltng:outApp" access="GLOBAL" implements="ltng:allowGuestAccess">
</aura:application>

LWC - "testLWC":
<template>
    <lightning-record-edit-form object-api-name="Case">
        <lightning-messages></lightning-messages>

        <lightning-input-field field-name="Subject"></lightning-input-field>
        
        <lightning-button   class="slds-m-top_small"
                            type="submit"
                            label="Create new">
        </lightning-button>
    </lightning-record-edit-form>
</template>

​​​​​​​ERROR:
Error Message
Best Answer chosen by Artem Kalus 7
Artem Kalus 7Artem Kalus 7
This got resolved a few weeks later after sandbox refresh.

All Answers

Artem Kalus 7Artem Kalus 7
This got resolved a few weeks later after sandbox refresh.
This was selected as the best answer
Gurditta Garg 16Gurditta Garg 16
Artem Kalus 7 - Did you find the root cause of this??
Dan VegaDan Vega
I'm having this same error message on creating a custom object - appears when "new" is clicked to create a new record.  The user has create rights. Have a ticket open with salesforce support.
Jesse RoweJesse Rowe
I'm also seeing this. Does anyone have a solution?
Jesse RoweJesse Rowe
I got around this issue by defaulting a value for ownerId to another user in the organization. I'm using e.force:createRecord and setParams to default to a different user.