Need a way to duplicate entities and layouts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • murugappan
    Active Community Member
    • Aug 2017
    • 467

    Need a way to duplicate entities and layouts

    Hi,

    One of the problems we face is the inability to export or duplicate (clone) an entity, layout or fields. This would be really helpful to develop new products faster with less mistakes. I know there aee currently no such facility but I feel it can be done in the back end. Only thing is i could not find sufficient technical documentation to help me do that. Appreciate any guidance in this. Thank you so much.
  • telecastg
    Active Community Member
    • Jun 2018
    • 907

    #2
    Hi, perhaps this can help, here's how Espo creates custom entities from the Administration panel:

    EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.

    Comment

    • esforim
      Active Community Member
      • Jan 2020
      • 2204

      #3
      From my host transfer I learn that most Entity file is in a folder call Custom
      \custom\Espo\Custom\

      Maybe you can just copy the entity you want, paste it under a new Filename. After that do the normal clear cache and rebuild and see if it show up. If it show up under the new name, then just edit it from the GUI afterward.

      Essentially you can "copy/paste" layout. The issue you may have is the "database", will doing this create a database table for you? Not sure.

      Comment

      • telecastg
        Active Community Member
        • Jun 2018
        • 907

        #4
        Hi @espcrm

        Originally posted by espcrm
        From my host transfer I learn that most Entity file is in a folder call Custom
        \custom\Espo\Custom\
        You also need to check the folder \client\custom\ for any front-end scripts and templates related to your entity.

        Originally posted by espcrm
        Essentially you can "copy/paste" layout. The issue you may have is the "database", will doing this create a database table for you? Not sure.
        It is correct, once the custom entity has been properly defined the system will create the necessary database tables and fields

        Comment

        • murugappan
          Active Community Member
          • Aug 2017
          • 467

          #5
          Originally posted by telecastg
          Hi, perhaps this can help, here's how Espo creates custom entities from the Administration panel:

          https://github.com/espocrm/espocrm/b...ityManager.php
          Hi telecastg,

          One of the things i learnt really hard way is that its never good to temper with the code. Reasons:
          (1) Version change, everything may become useless and may require extensive rework, testing and migration
          (2) When someone takes over from me, it will be real pain to him and me in terms of maintenance and handover.

          Better to avoid this pain than to be sorry later. Rather try and use espcrm idea. Thank you so much guys. Wonderful people.

          Comment


          • telecastg
            telecastg commented
            Editing a comment
            Hi murugappan, I completely agree with you that core code should not be tempered with because it can create a lot of unintended problems.

            My suggestion to look into the script was just to learn what kind of folders and files are created by the Administration panel create entity facility, to be able to design (hopefully) an "ungrade safe" way to clone entities through a custom php script.

            Cheers :-)

          • esforim
            esforim commented
            Editing a comment
            To further input, yes any core files will be update and it will be annoying to "restart" your project and code from the beginning again when these update hit. Only a few folder will get untouched from an update or upgrade (One of which is the Custom Folder?).

            Alternatively I suppose you could always write an Extensions if you have coding skill. If it enough of a major usage, a Pull request into their Git will allow the majority of user to use it also.

            In term of version and future "Administration" that is where documentations and version control software (such as Git) is useful. I tried Git one time before, I failed at using it. As for documentations? Who really have time unless this is their full time work. Most of my documentation is a quick copy/paste essential details and very brief details when it come to back end software (EspoCRM, website, server, etc).

          • telecastg
            telecastg commented
            Editing a comment
            Aside from the core application scripts, Espo works in "modules', Crm is actually a module.

            Any customization through the Administration Panel (entities, layouts, links, etc) is stored in the "Custom" module.

            All back-end scripts (PHP and JSON metadata) go under the folder custom/Espo/Custom/ and all front-end scripts (Javascript and templates) are stored under the folder client/custom/

            Upgrades will not affect anything under the "Custom" module or under any other extension modules.

            A good way to learn more about this structure is to download the free Real Estate extension and see how the folders are organized.
            Last edited by telecastg; 03-02-2020, 03:56 PM.
        • murugappan
          Active Community Member
          • Aug 2017
          • 467

          #6
          Hi telecastg and espcrm,

          It is really wonderful discussing here. Thank you folks.

          I managed to clone one of the entities from one instance of crm to another. Phew! that feels really good because i didnt have to do it all over again. I think Espo should seriously think about providing export/import facilities for entity/layout definitions. I feel that this is long overdue especially with the likes of SuiteCRM already providing this very long time ago. I tried to clone-out the enum lists but successfully failed. Somehow, the system ignores what i have changed in the custom folder.

          With regards documentation, this was my review feedback to Espo sometime back. Espo lacks continuous-flow documentation which makes things really difficult for users to share examples and success stories. There are some of us here who are willing to maintain a good set of documentation and examples on behalf of Espo provided Espo themselves document the changes for each release. This is another lacking. An example, in my opinion, is the documentation on workflow and API which are really confusing. It may just be me. More so with absence of complete solution-examples.

          Comment


          • esforim
            esforim commented
            Editing a comment
            The problem is not enough man-power I suppose. From a popularity point of view EspoCRM isn't that high on the list of recommend "Free/Open Source" or just CRM in general. Looking at the Developer, there seem to be only one main Developer: yurikuzn (https://github.com/espocrm/espocrm/graphs/contributors)

            There a few code contributions from the community, whereas if you look at SuiteCRM: there if quite a few contributors there. All come down to the user-base. But this is for another thread and topics.
        • telecastg
          Active Community Member
          • Jun 2018
          • 907

          #7
          Originally posted by murugappan
          I tried to clone-out the enum lists but successfully failed. Somehow, the system ignores what i have changed in the custom folder..
          Hi murugappan, enum lists are defined in the entityDefs metadata JSON file for the entity.

          For example, I have a "ServiceTask" entity wich has an enum type field "ServiceType" and this is what the ServiceTask entityDefs content looks like:
          Code:
            "fields: {
          
          // other fields
          
                  "taskClass": {
                      "type": "enum",
                      "options": [
                          "Internal",
                          "External"
                      ],
                  }
            }
          so if I want to clone this entity's enum values I would have to close the entityDefs content. Hope this helps.

          Comment

          • esforim
            Active Community Member
            • Jan 2020
            • 2204

            #8
            Someone revived this thread and I came across it. It is very relevant to your question and the topic.

            Comment

            • eymen-elkum
              Active Community Member
              • Nov 2014
              • 472

              #9
              I have made post regarding this request, hope it can help,

              As we know EspoCRM already support four entity types (structure templates) for now: • Base. • Base Plus • Person. • Company.But sometimes you may need to clone an existing entity including all related functionalities. For example you may want to duplicate the "Meeting" or "Call" ones, or even to duplicate custom entities definitions you made by your hand from one crm to another or in the same crm.Let's say we want to clone the "Meeting" entity as example to a new entity names "Lesson",- Create t
              CEO of Eblasoft
              EspoCRM Expert since 2014
              Full Stack Web Developer since 2008
              Creator of Numerous Successful Extensions & Projects​

              Comment

              • murugappan
                Active Community Member
                • Aug 2017
                • 467

                #10
                Hi Guys,

                Thank you for the posts and reply. With regards to cloning, i had already done that earlier. It was similar to what the document ayman.alkom pointed to. It worked fine. As for the enum lists, i tried what telecastg said but didnt work. I may have done something wrong. I have will try it again later and update here.

                Comment

                • esforim
                  Active Community Member
                  • Jan 2020
                  • 2204

                  #11
                  This thread might be relevant to your Enum issue:
                  https://forum.espocrm.com/forum/gene...-add-to-fields

                  Originally posted by ayman.alkom
                  I have made post regarding this request, hope it can help,

                  https://www.eblasoft.com.tr/post/clo...ity-in-espocrm
                  Very good article, but I have to question the, "1 min read".
                  Last edited by esforim; 03-11-2020, 07:57 AM.

                  Comment


                  • eymen-elkum
                    eymen-elkum commented
                    Editing a comment
                    I never noticed that, I think it needs at least 15 min

                  • eymen-elkum
                    eymen-elkum commented
                    Editing a comment
                    I also think about making videos for such articles what do u think?

                  • esforim
                    esforim commented
                    Editing a comment
                    You already have screenshot which is good enough, I don't think Video will be helpful in this instance (take too much time, edit, creating, upload) and video tend disappear in a few year time due to filesize.

                    For bigger project or multiple guide, a video would certainly be helpful. However uploading video relating to EspoCRM at this stage is good for promoting more people to look into EspoCRM, doing a search on Youtube for EspoCRM give very little result.
                • murugappan
                  Active Community Member
                  • Aug 2017
                  • 467

                  #12
                  Another snag in Espocrm is the inability to export/import Roles, Teams and Users. All these need to kept in a hard copy report and then reentered when needed.

                  Comment

                  • miguel.torrez
                    Junior Member
                    • Jun 2021
                    • 1

                    #13
                    it is possible to duplicate the quote entity to use it as a different form but based on that entity?

                    Comment


                    • esforim
                      esforim commented
                      Editing a comment
                      Probably but you can't distribute that because Quote entity is licensed (Sale Extension pack?). As for how, I dont think anyone be able to give you step by step guide.
                  Working...