Announcement

Collapse
No announcement yet.

Change type of entity to get activities, history and tasks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Change type of entity to get activities, history and tasks

    Hi there,

    We created a new entity type when we first set up Espo a couple of years ago. At the time, I don't think Base Plus was available, so we created it as a Base. As a Base, it doesn't have activities, history or tasks against it, which we now need. Is it possible to change the entity type somewhere in the database without causing any issues to the data already stored in Espo? As it's an entity we've been using for quite a while, there's a lot of data already in there so having to create a new entity and move the data across to that would be a pain.

    Thanks in advance for any support.


  • #2
    Hello,

    1. Extend links in your entityDefs (custom/Espo/Custom/Resources/metadata/entityDefs/{EntityName}.json > links > tasks, calls, meetings, other custom event entities)
    https://github.com/espocrm/espocrm/b...yDefs.json#L58 (you can copy and paste it)

    2. Add your entity to parent list with Entity Manager > {each Event entity} > parent > add your entity to the list.

    3. Add to your clientDefs sidePanel definition (custom/Espo/Custom/Resources/metadata/clientDefs/{EntityName}.json > sidePanels)


    4. Administration > Rebuild > Refresh the page

    Comment


    • #3
      Hi Tanya,

      That's brilliant, thank you!

      One more question - I'm now able to add calls and meetings against my new entity type, but when I do it automatically selects all of the contacts linked to that enity type as being part of the call or meeting. This is fine when there's just one contact stored against the entity, but when there are several (some of which may no longer work there), it's a bit annoying having to remove them. Is there a way to get it to not select any contacts so that I can pick them myself?

      Comment


      • #4
        Sorry Tanya, another question: currently when I add a call against a contact linked to an account, the call shows up in the activity or history of both the contact and the account. However, when I add a call against a contact linked to my new entity, the call only appears in the acitivity or history of the contact, not the new entity. Is there a way to get it to appear against the new entity too?

        Comment


        • #5
          only if you create this relationship and set this relation in formula or with workflow.

          Comment


          • #6
            Sorry, that doesn't really help me (more because of my experience with Espo than your answer).

            What I have realised, is that when I'm adding a call or meeting against a contact, it is currently selecting the contact as the parent, not the new entity. I have updated the layout so that I'm able to see this when creating a call, but currently I can't even manually change the parent because my new entity ("Academy Sponsor") doesn't appear as an option in the parent dropdown.

            Ideally, what I'd like it to do is automatically select the Academy Sponsor that the contact is linked to as the parent when I create a new call or meeting. Is there a way to do that? Do I need to set up some sort of parent-child link between my Academy Sponsor entity and calls/meetings/tasks?

            Comment


            • #7
              Just in case I'm not making sense with my words, I've attached a screenshot of what I'm trying to achieve.

              Click image for larger version

Name:	espo screenshot.png
Views:	1237
Size:	618.7 KB
ID:	42932

              Comment


              • #8
                Administration > Entity Manager > Call > fields > Parent > add your entity to the list

                Comment


                • #9
                  Ah, thank you Tanya, I get that bit now.

                  The last thing I'm trying to do is set up a workflow so that when I create an event against a contact with a linked academy sponsor, it automatically updates the parent to become the academy sponsor, not the contact.

                  Attached is a picture of the set up I have so far, but that doesn't seem to work. Is it easy for you to diagnose what I'm doing wrong?
                  Attached Files

                  Comment


                  • #10
                    check the contact field name. I don't believe that it is academy_sponsor_id

                    Comment


                    • #11
                      Hi Tanya,

                      You were right. I've updated it so it now looks like this, but it still isn't working. Any ideas?
                      Attached Files

                      Comment


                      • #12
                        you need id field - academySponsorId
                        and don't forget about ';'

                        Comment


                        • #13
                          Hi Tanya,

                          I tried that but still no luck. When I go into entity manager and look at the fields for contacts, I don't actually have an academy sponsor ID field, just academySponsor. I don't know how to add the ID as a field against contact.

                          I tried updating my workflow to this:

                          parentType = "Academy Sponsor";
                          parent = contact.academySponsor

                          but that didn't work either.

                          Sorry to be a pain, but do you have any other suggestions? I really appreciate your help.

                          Comment


                          • #14
                            parentType = "Academy Sponsor";
                            parentId = contact.academySponsorId

                            Comment


                            • #15
                              Yes, that's what I had before, but it wasn't working, which is why I tried changing it to

                              parentType = "Academy Sponsor";
                              parent = contact.academySponsor

                              As I mentioned in my previous post, when I go into entity manager and look at the fields for contacts, I don't actually have an academy sponsor ID field, just academySponsor. Do I need to create an academy sponsor ID field? If so, how do I do that?

                              Comment

                              Working...
                              X