I'm missing some specifics, but I'll give the closest thing to the solution I could find.
On not being able to access default values
If you add a default value to the tag in the metadata file, the behavior is that it prepopulates the input field with that default value. When you edit that property, the component no longer follows the default value. This includes if you edit the field to be blank -- the default value never repopulates unless you delete and recreate the element.
This is not generally useful for retrieving a germane record, but is nice to know, definitely saved me some time copying down Ids testing this LWC.
On not passing in variables
@nbrown's hypothesis that passing $User worked in flows because it's a global variable in the flow context, but not in LWCs because it isn't defined in that context seems to be the case. I could not pass any sort of global variable into the input property, only {!recordId}. If you need data other than recordId, it needs to be resolved outside of the LWC and the Id itself passed into the variable.
Ultimately, my solution was to put the LWC on the User profile page (as it is a User Record Detail Page) to get the User Id from {!recordId}, and within the component use an LDS wire to lookup the ContactId I needed for the form:
JS:
import { LightningElement, api, wire } from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import CONTACT_OBJECT from '@salesforce/schema/Contact';
import USER_CONTACT_FIELD from '@salesforce/schema/User.ContactId';
export default class EditContactExternalForm extends LightningElement {
// Expose recordId to get info from parent
@api recordId;
@wire(getRecord, { recordId : '$recordId', fields: [USER_CONTACT_FIELD]}) user;
get contactId() {
return getFieldValue(this.user.data, USER_CONTACT_FIELD);
}
objectApiName = CONTACT_OBJECT;
layoutType = 'Full';
}
HTML
<template>
<lightning-record-form
object-api-name={objectApiName}
record-id={contactId}
layout-type={layoutType}>
</lightning-record-form>
</template>
XML
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>52.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightningCommunity__Page</target>
<target>lightningCommunity__Default</target>
</targets>
<targetConfigs>
<targetConfig targets="lightningCommunity__Default">
<property name="recordId" type="String" required="false"/>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
Best Answer
A flow has variables that you set as available for input. Each variable has a name and a type.
When passing values for these variables you must simply pass a JavaScript array of object with properties that name the variable and provide the variable type and value.
Assuming you called your variable "recordId" in the flow and it is a string that receives an ID from your LWC, you need to do the following: