Dynamically create fields for an entity?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JosNas
    Member
    • Sep 2021
    • 97

    Dynamically create fields for an entity?

    How to dynamically create fields for an entity?

    Hello, if an applicant fills a form via Lead Capture, the data filled will be sent to fields that are already created(such as phoneNumber, address, Account, etc...). Great.

    But what if the form has an add more (+) button to certain fields?

    Example: one applicant works at 1 company (account), another works at 2 different companies, and a third applicant works at 5. So in the form the third applicant clicks an add more button 5 times to add another company he works at. Is there a way to send this dynamically added data to create a lead via Lead Capture? (I was thinking maybe a workflow can create fields?)
  • dimyy
    Active Community Member
    • Jun 2018
    • 569

    #2
    May be use JSON for this case?

    Some mandatory fields and additional data?

    Comment

    • item
      Active Community Member
      • Mar 2017
      • 1476

      #3
      Hello,

      there are many sample on the web for : how submit form with array (add button) in ajax
      sample : https://www.codexworld.com/add-remov...-using-jquery/

      Your problem is LeadCapture out-of-box.

      You need create in Lead a "matrix" type field from telecastg https://payhip.com/TelecastGroupSoftware for easy to archive what you will

      If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

      Comment


      • JosNas
        JosNas commented
        Editing a comment
        I know how to add fields dynamically in my form which is not a problem. I think the issue is how can I let Espo know that there are more fields being created in the form so that they can be sent in the payload. One approach would be maybe to create around 10 extra empty fields in Espo's `Lead` Entity Manager that become visible once they are not empty (i.e. they got added and filled in the form) but that would be naïve and not the best approach. Also, thank you for your reply!
    Working...