[SalesForce] Fields required at layout level are not required in lightning-record-form lwc

I am trying to create a new button for a Custom object to add it in community.On clicking the button lightning-record-form will be displayed in edit mode to show input fields of the layout but what ever fields are required on the layout are not showed as required on the form.

Best Answer

As of Winter '20 you can make the lightning-input-field component required

lightning-input-field The following attribute is new.

  • required—To make an input field required only on the client, include the required attribute. Use this attribute to require a value in a field before the form can be submitted, and the field isn’t marked required in Setup. If the field doesn’t have a value, the component’s client-side validation catches the error before the form data is submitted to the server.

https://releasenotes.docs.salesforce.com/en-us/winter20/release-notes/rn_lwc_components.htm