Drop down menu in Entity's

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MATO
    Member
    • Jun 2019
    • 98

    Drop down menu in Entity's

    Hi All

    We need to create a form that provides a Part Name drop down and when Part is selected we get another drop down with the Part numbers available.

    Fore Instance

    Part1 - 100-345
    - 100- 346
    - 100 - 347

    Part 2 - 200 -345
    - 200 - 346
    - 200 - 347

    Any thoughts on how we can do this.

    Thank you in advance

    MATO
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    #2
    There isn't a "Category" "Sub-category" drop down available yet I believe. Only way I think you can do this now is to use "Conditional formatting" which will show/hide field as you select them. Unfortunately it will look quite ugly as there will be hidden field with a blank area.

    You probably have to use one of the Extension by a 3rd party developer: eymen.elkum

    Comment

    • MATO
      Member
      • Jun 2019
      • 98

      #3
      Thank you - Is there a how to guide for "Conditional formatting" ?

      Comment

      • esforim
        Active Community Member
        • Jan 2020
        • 2204

        #4
        Not that I'm aware of. It seem fairly easy though because the GUI is quite straightforward. I haven't use it so don't have any personally input yet.



        Look under the Dynamic Logic area. Most if not all field will have that option when you go into Edit.

        Comment

        • telecastg
          Active Community Member
          • Jun 2018
          • 907

          #5
          Do you want a dropdown (select) element where you choose one item ("product category" for example) and depending on that choice ("computers" for example) then a second dropdown displays all items classified as "computers" ?

          Comment


          • MATO
            MATO commented
            Editing a comment
            Yes that is exactly what I am looking for.

          • telecastg
            telecastg commented
            Editing a comment
            I think this free extension https://github.com/EspoCRM-Custom-Mo...num-from-SQL  will do the job, check the README page for instructions on how to use.

            It basically allows you to write plain vanilla SQL and placeholders as data source for a select element in the entityDefs file.
            Last edited by telecastg; 02-28-2020, 08:58 PM.

          • MATO
            MATO commented
            Editing a comment
            Hi Telecastg

            I get a error 404 on that link.

            Thank again

            MATO
        • telecastg
          Active Community Member
          • Jun 2018
          • 907

          #6
          Sorry about the mispelled link, here's the correct one https://github.com/EspoCRM-Custom-Modules/Enum-from-SQL

          Comment

          • nickh
            Member
            • Jun 2018
            • 67

            #7
            Hi
            I have having difficulty with this extension. I have an standard enum "industry" and use this to populate a dropdown "profession" based on industry value, but no values appear.
            The sql works and returns values. Am I missing something extremely obvious?

            From opportunity.json

            "profession": {
            "type": "enum-from-sql",
            "options": [],
            "style": {},
            "default": "",
            "isCustom": true,
            "selectSQL": "SELECT job_professions.profession AS profession FROM job_professions WHERE job_professions.sector = '@@{{industry}}/@@' order by job_professions.profession"
            }


            Thanks

            Comment

            • Maximus
              Senior Member
              • Nov 2018
              • 2731

              #8
              Hi nickh,
              I've noticed that you are looking on how to manage the enum fields menu based on another option. I think it is not possible to do via request to DB. Please investigate this topic https://forum.espocrm.com/forum/gene...tional-options.

              Comment

              • nickh
                Member
                • Jun 2018
                • 67

                #9
                Hi Maximus
                Thanks for this. The issue I have is that 1 industry can lead to 50 professions and up to 400+ fields of expertise - there are two fields whose options rely on the previous field value. altogether there are 20 industries, 441 professions and over 2000 fields of expertise. Manually entering is hazardous which is why I was looking to populate the fields using a sql query.
                Do you have any other suggestion?

                Comment

                • nickh
                  Member
                  • Jun 2018
                  • 67

                  #10
                  Hi Maximus
                  Is this more what I am looking for? https://forum.espocrm.com/forum/deve...-multiple-link

                  Comment

                  • Maximus
                    Senior Member
                    • Nov 2018
                    • 2731

                    #11
                    This post https://forum.espocrm.com/forum/deve...-multiple-link applies to Link-multiple connections (see relationship https://docs.espocrm.com/administrat...#relationships).
                    The article provided by me applies to multi-enum fields https://docs.espocrm.com/administrat...ds/#multi-enum.

                    If you are not using relationships but multi-enum fields, you cannot make a query to your DB, because DB doesn't store all options of the current enum type field. DB stores only a saved enum field value for each personal entry. I agree that using the dynamic condition through UI for such a big list is an incredibly hard way. To avoid using the dynamic logic via UI, you can try to make your custom dynamic logic through code. This way needs some coding skills but it is much better for maintaining these fields logic and make some changes.
                    Please read this https://docs.espocrm.com/development/dynamic-handler/.

                    Comment

                    • nickh
                      Member
                      • Jun 2018
                      • 67

                      #12
                      Thanks Maximus Will study and decide best way forward.

                      Comment

                      • Maximus
                        Senior Member
                        • Nov 2018
                        • 2731

                        #13
                        Hi nickh,
                        I've made a tutorial of how to make the dynamic logic on the code layer https://forum.espocrm.com/forum/gene...1706#post61706. I hope it will be helpful. In your case, you have a long enum field, so I assume that building dynamic logic via code is the best solution for you.

                        Comment

                        • nickh
                          Member
                          • Jun 2018
                          • 67

                          #14
                          Hopefully final question Maximus
                          Am using the more basic option - can I have the option to "Allow Custom Option" when the list is conditional as attached?

                          Comment

                          • Maximus
                            Senior Member
                            • Nov 2018
                            • 2731

                            #15
                            If 'Allow Custom Option' checked, then a user can add custom values (not defined by Options parameter) by typing text and pressing the enter key. So it will allow you to add your options upon inline edit.

                            Comment

                            Working...