Populate Enum Field from Database List

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blueprint
    Active Community Member
    • Jan 2019
    • 223

    Populate Enum Field from Database List

    Is there any out-of-the-box way of populating an enum field from values from a database?

    We have the Sales Pack and what I would like to do is to assign "Options" to "Products" so that at the point of creating a quote/order, when line items are added, the options can also be shown to force a selection by the user inputting the quote or order.

    For example:

    Product: Computer
    Product Option: Plug Type
    Product Option Values: USA, UK, Europe, Middle East, Australia

    This could be done as a separate line item (a Product for each option) but I don't know how I could enforce a selection at the point of quote/order.

    Thanks.
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    Hello blueprint, had a similar situation and managed to find a way to populate the enum using plain vanilla SQL written in metadata, check this link for the solution: https://forum.espocrm.com/forum/deve...ed-in-metadata

    Comment

    • anhy123
      Banned
      • Mar 2020
      • 2

      #3
      had a similar situation and managed to find a way to populate the enum using plain vanilla SQL written in metadata, check this link for the solution: https://forum.espocrm.com/forum/deve...ed-in-metadata

      Comment

      • telecastg
        Active Community Member
        • Jun 2018
        • 907

        #4
        Kyle has reported a security risk using this extension because at present a user might inject sql by copying and modifying the ajax payload.

        I will look into this, but in the mean time please take the necessary precautions if you are using or plan to use this extension.

        This free extension and others that I have published are NOT commercial products so they have not been tested thoroughly, they are experimental code examples meant to illustrate ways in which Espo can be customized.

        Comment

        Working...