Hi, I have added fields to the fieldset and marked them as required. However, when these fields are rendered in the UI using lightning-record-edit-form with lightning-input-field inside a loop, they do not appear as required. Is there any workaround for this? It seems that the fields are only marked as required at the object level, which is why the required attribute is not reflecting in the UI
@@pavankumarv6849 you have to get the values from the describe of those fields and mark them required while looping over, also how did u mark them. Required on layout level or database level?
@@salesforcein5minutes thank you for the reply, that is the only way to mark them as required in UI. I made those required in fieldset level - if i would have made them required at object level then it would have been shown as required with red asterisk
I have a same kind of requirement but instead of field name i want to display some other message on a particular field,Is there any way for that? Any help would be great
@@vaibhavsharma5114 there are ways with which we can add variants to the fields naming it as 'no label ' and after that we can give label as per as our need
Sure you can do that not a problem but for that you need to create a wrapper class so that different objects fieldsets can be passed to your lwc component
@salesforcein5minutes, thanks for the reply!, okay understood, as this fieldsets is new for me, what other changes or additional things we need to add in the LWC side, so that I can display different sobjects fields in a single form
@@adarshas1096 1)if you are showing everything within single form itself using record edit form it wont be possible , you have to use 2 record edit form as these fields are coming from 2 diff objects 2) saving the form will be difficult, you have to write your own apex class to save record as you have to collect data from one object and then from another and finally make an apex call to save records 3) showing errors and validation can be challenging as these 2 objects can have different validation but only have single save button so in that save button handle validation for 2 diff objects
Hi,
I have added fields to the fieldset and marked them as required. However, when these fields are rendered in the UI using lightning-record-edit-form with lightning-input-field inside a loop, they do not appear as required.
Is there any workaround for this? It seems that the fields are only marked as required at the object level, which is why the required attribute is not reflecting in the UI
@@pavankumarv6849 you have to get the values from the describe of those fields and mark them required while looping over, also how did u mark them. Required on layout level or database level?
@@salesforcein5minutes thank you for the reply,
that is the only way to mark them as required in UI.
I made those required in fieldset level - if i would have made them required at object level then it would have been shown as required with red asterisk
@@pavankumarv6849 you have to get the fieldset value getrequired() and others and based on that mark it required
@@salesforcein5minutesthank you very much for the advice
Please show the version with picklist values as well. Thanks..
I have a same kind of requirement but instead of field name i want to display some other message on a particular field,Is there any way for that?
Any help would be great
Message do u mean instead of label? You wanna show some other message?
@@salesforcein5minutes yes right instead of field label name i want to display a question on that particular field label
@@vaibhavsharma5114 there are ways with which we can add variants to the fields naming it as 'no label ' and after that we can give label as per as our need
@@salesforcein5minutes Sure i'll try thanks
Hi, can we use the fieldsets created from 2 or more different sobjects and write apex code to return all the fields into a single form?
Sure you can do that not a problem but for that you need to create a wrapper class so that different objects fieldsets can be passed to your lwc component
@salesforcein5minutes, thanks for the reply!, okay understood, as this fieldsets is new for me, what other changes or additional things we need to add in the LWC side, so that I can display different sobjects fields in a single form
@@adarshas1096
1)if you are showing everything within single form itself using record edit form it wont be possible , you have to use 2 record edit form as these fields are coming from 2 diff objects
2) saving the form will be difficult, you have to write your own apex class to save record as you have to collect data from one object and then from another and finally make an apex call to save records
3) showing errors and validation can be challenging as these 2 objects can have different validation but only have single save button so in that save button handle validation for 2 diff objects
@@salesforcein5minutes oh okay, thank you!
@@adarshas1096 welcome