+ Start a Discussion
SFDC 1904SFDC 1904 

Can we clone records using lightning data services in lwc?

When my custom clone button is clicked, I am setting recordId as null for 'lightning-record-edit-form'.
this.template.querySelector('lightning-record-edit-form').recordId = null;
this.template.querySelector('lightning-record-edit-form').submit(fields);

I am able to clone records but for required fields it is gving duplicate rule error for lightning-input-field field with error.

Note: If you don't interact with a required field and try to submit the form, an error message is displayed.

I want to hide this standard error message. How can I hide it?

AbhishekAbhishek (Salesforce Developers) 
I suspect it's not possible.

You can raise an Idea for it in Idea Exchange based on the Votes it will be available in the future.


If it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.