Decoding Lightning Record Edit Form in LWC | Lightning Data Service in LWC | LWC Tutorial
Вставка
- Опубліковано 7 вер 2024
- Hello Trailblazers, In this video we're going to learn how we can use Lightning Record Edit form in Lightning web components. We're also going to learn about the different attributes of lightning record edit form along with their purpose and the events which are fired at different instances while interacting with lightning record edit form. We'll also see how we can handle errors and setup default field values just before the form is submitted.
Code:- github.com/rah...
Subscribe to SFDC Stop:- www.youtube.co...
LWC Todo App Project Tutorial Series - • Simplifying the Callou...
Interested in learning about Scratch Orgs and SFDX ? Have a look at the playlist:- • Getting started with S...
Interested in learning about Integration ? Have a look at this playlist:- • Salesforce Integration...
Hi Rahul,
Can we have picklist fields in lightning record edit form, or the dependent picklists ?
Hi Rahul,
Thanks for making this video.....Its very helpful for all of us...
Please make the video on winter 22 release to display related Objects
records in lightning record forms using uiRelatedListApi
ex.
Parent Object: Opportunity
Child Object : Opportunity Line Item, Orders
How can I assign a value to field automatically it has to populate on that field value in lightning input field
You can get a reference to the field in onload event and set a value
Is it possible to assign a default value to a field before submitting the form based on that field i need to do validation on other fields
Hi Naveen, yes it's possible by using the onsubmit event
Thanks Rahul. your videos are detailed and to the point. I have couple of questions based on this video.
1. on submit when you have overridden the data - mobile phone number is not prepopulated even though it has been persisted. If that has to be displayed do we have to set the details explicitly again.
2. I was trying to see a record-form where upon saving it is blank and I can start adding a new record rather than default behavior. Basically I always want to keep the form empty as soon as I hit save and the form is ready for new account data to be entered...
Hi Mahi, thank you for your feedback! Regarding the two queries:
1. You need to update the record id in the record edit form once the save is successful and it'll refresh itself (usually we redirect the user to some other screen/page in this case or reset the form to show it as empty as getting some pre-filled values after saving when the user hasn't entered those may confuse the user)
2. The default behaviour of lightning-record form is that it'll set the record id of the newly created record onto the form and switch to a read mode from the edit mode once the record is saved, you can try clearing the record id on success and check if that works. Although using record edit form is a better option for this use case if you're sure what fields you need to display.
@@sfdcstop hi brother I have a small requirement to build a screen to add/update order record and order line and contacts as well and upload them as csv file, can you please help me with approach
Hi Rahul!
Thanks for sharing us the video.
I have a question. Can we add a label to the ?
For example we pass the api name to the field name. How can I see it displayed as a “Email address” on the form?
Thanks in advance.
how to show two diffrent objects fields on one lightning form lwc and on saving data goes to respective object ?
Hi Amit, if you're standard record edit form then you may need to use two such forms and submit both of them one by one, otherwise, you can create a custom lwc component.
hello sir, u used there to display the messages at that position ?? I search for lightning-message component reference but unable to find any document Thank You.
Hi Lukesh, that component is specific to lightning record edit form, view form and record form. It can be used inside them only, you can find it in the documentation page here:- developer.salesforce.com/docs/component-library/bundle/lightning-record-edit-form/documentation
Hi if we use two lightning record edit from in single lightning web component, how we can handle save function
Hi Satya, do you want to have a single save button for both? If yes, you can get references to lightning-record-edit form using the querySelector() and submit both the forms one by one.
sir can you make a video end to end on salesforceDX its really helpfully to me and others and LWC also.
Hi Parvati, Thank you for the suggestion. To get started with LWC you can refer to the LWC Tutorial Series with Todo App Project: ua-cam.com/play/PLuL63vr-9xHyaEARj8crQe3v2TBQa_Cs8.html
You'll have a project to showcase at the end of this playlist and it's from scratch. For SalesforceDX you can refer to this playlist: ua-cam.com/play/PLuL63vr-9xHwW96U64tORGA0HT5j1m0Ff.html
It covers all important sfdx commands. Hope that helps!
@@sfdcstop Thank you so much sir, for providing link and thanks for supporting the people as well. and please dont remove the videos.
Videos will be here as it is always 😊 no need to worry about that 👍 Keep Learning..!!
Awesome video 👍😁
Thank you Buddy 😁
Hi Sir, i have small ques
1. there are event.target.value and event.detail.message and EVENT has many properties like so on which criteria we should use which one? im getting confused in selecting the Event.property type
Hi Pavan, event.target.value is basically used to get the value of the input field. event.detail.message is mainly used when custom events are fired because in that case the value which is passed in the event is present in the detail attribute.
@@sfdcstop Okay got it.. thanks brother.. now I understood.
Sir how to make this more flexible like we need to give an text box for entering customer id & based On that customer id the details need to be fetched and it should be editable
Sir actually this is an requirement for me...can you please explain how to acheive this feature
Hi Hema, you need to create a custom UI for this and call the apex method once the customer ID is added by the user. The apex method can query return the whole record that you can display in the component
Suppose I have to call another record form after submitting this form in onsuccess event how can we do that ?
You can call resetForm() again once the submission is successful!
After refreshing records..records not remains...any solution??
Hi Pranav, can you explain in a bit detail?
@@sfdcstop I have created custom fields in custom object and that fields are saved also but when i press the refresh button fill records not remains..requirement is that records view like account details..