wireGetRecordDynamicContact - value not specified for property
mikearthur7b0 opened this issue · comments
Summary
On line 14 there is no value specified for the fields
property.
@wire(getRecord, { recordId: '$recordId', fields })
Maybe it should be as shown in the docs
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.data_wire_service_about
const FIELDS = [...];
...
@wire(getRecord, { recordId: '$recordId', fields: FIELDS })
Salesforce Org Type
Sandbox
Steps To Reproduce
N/A
Current Behavior
N/A
Expected Behavior
N/A
Relevant Log Output
N/A
Code of Conduct
- I agree to follow this project's Code of Conduct
Welcome! 👋
Thank you for posting this issue. 🙇🏼♂️ We will come back to you latest within the next 48h (working days). Stay tuned!
Hi @mikearthur7b0, thank you for raising this. The above syntax is an ES6 javascript shorthand property naming. If you assign a variable to the property with an identical name, you can directly use the variable/constant name. You need not give 'name: value'.
In the recipe, we declared fields
, hence we need not use fields: fields
. Instead, we can simply use fields
.
Thank you for clarifying that @satyasekharcvb, and improving my knowledge of ES6 :-)
I'm not a fan of that shorthand as it reduces the readability of the code. Just an opinion, but in an educational example I would make the code as simple as possible to understand.