Using Fieldsets inside Record Edit form | Lwc Tutorial Part 21

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ก.พ. 2025

ความคิดเห็น • 17

  • @pavankumarv6849
    @pavankumarv6849 หลายเดือนก่อน +1

    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

    • @salesforcein5minutes
      @salesforcein5minutes  หลายเดือนก่อน +1

      @@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?

    • @pavankumarv6849
      @pavankumarv6849 หลายเดือนก่อน +1

      @@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

    • @salesforcein5minutes
      @salesforcein5minutes  หลายเดือนก่อน

      @@pavankumarv6849 you have to get the fieldset value getrequired() and others and based on that mark it required

    • @pavandkbose
      @pavandkbose หลายเดือนก่อน

      ​@@salesforcein5minutesthank you very much for the advice

  • @ExplorerDeepita-wy7ut
    @ExplorerDeepita-wy7ut 8 หลายเดือนก่อน +1

    Please show the version with picklist values as well. Thanks..

  • @vaibhavsharma5114
    @vaibhavsharma5114 5 หลายเดือนก่อน +1

    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

    • @salesforcein5minutes
      @salesforcein5minutes  5 หลายเดือนก่อน

      Message do u mean instead of label? You wanna show some other message?

    • @vaibhavsharma5114
      @vaibhavsharma5114 5 หลายเดือนก่อน +1

      @@salesforcein5minutes yes right instead of field label name i want to display a question on that particular field label

    • @salesforcein5minutes
      @salesforcein5minutes  5 หลายเดือนก่อน

      @@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

    • @vaibhavsharma5114
      @vaibhavsharma5114 5 หลายเดือนก่อน +1

      @@salesforcein5minutes Sure i'll try thanks

  • @adarshas1096
    @adarshas1096 11 หลายเดือนก่อน +1

    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?

    • @salesforcein5minutes
      @salesforcein5minutes  11 หลายเดือนก่อน

      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

    • @adarshas1096
      @adarshas1096 11 หลายเดือนก่อน +1

      ​@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

    • @salesforcein5minutes
      @salesforcein5minutes  11 หลายเดือนก่อน

      @@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

    • @adarshas1096
      @adarshas1096 11 หลายเดือนก่อน +1

      ​@@salesforcein5minutes oh okay, thank you!

    • @salesforcein5minutes
      @salesforcein5minutes  11 หลายเดือนก่อน

      @@adarshas1096 welcome