I was wondering how to connect the FieldApiName from the schema and html in the right way and haven't found any useful information yet:
My First approach was like this:
value={Account[ACCOUNT_FIELD_FIELD.fieldApiName]}
which is sadly not working.
I have experimented some more and this my current version:
<lightning-input
label="I would like to use the Schema Label here"
value={Account.field__c}>
</lightning-input>
import ACCOUNT_FIELD_FIELD from
'@salesforce/schema/Account.field__c';
get field(){
return this.Account[ACCOUNT_FIELD_FIELD.fieldApiName];
}
So obv i could use a getter like the one I defined in JS but it feels like I'm wasting a lot of space with it.
So now to my questions:
- What would you say is the best way to put the value from a Field into the lightning-input component?
- is their another way than apex to get the label of the field?
this is my first question here please tell me if i have done some mistakes in how I wrote my Question(s).
Edit:
Im trying to maintain the structure of a Record Object as my actual use is more complex. so creating a @track var / getter for every field value is something that I would like to avoid.