Announcement

Collapse
No announcement yet.

Change opportunity's contacts field (make contactRole multi-enum field)

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

  • Change opportunity's contacts field (make contactRole multi-enum field)

    i need to change the contactRole field type from enum to multi-enum so that on an opportunity a contact could be (Influencer - decision maker) at the same time. is there a way to change the field to be multi-enum field? see attached screenshot.

    thanks
    Attached Files

  • #2
    Yes it is possible, check this post for instructions. https://forum.espocrm.com/forum/gene...-to-multi-enum

    The most important thing to keep in mind, is that although the actual database field does not change, the contents are handled different, enum stores a string and multi-enum stores a json array which members are the chosen values, thus you will need to manually update the contactRole field in existing records from "role-x" to ["role-x"]

    Comment


    • #3
      hey telecastg

      Thanks for you reply.

      I have tried changing the field type but it didn't work, i have changed the type of opportunityRole field on contact's clientDefs to multiEnum but the field disappear when i tracked it down it looks like contacts field on opportunity is a custom field which inherits this view (views/fields/link-multiple-with-columns-with-primary) which also inherits (views/fields/link-multiple-with-columns) and on this last view there is only support for 3 columns type (varchar - enum - bool) see attached screenshot. not sure how to this and i would appreciate if you could help in any way.

      thanks
      Attached Files

      Comment


      • telecastg
        telecastg commented
        Editing a comment
        Unfortunately, the proposed solution only works when you are changing a simple enum to a simple multi-enum field type.

        It looks like the opportunityRole is really not a simple enum field but an additional field in the Many-to-Many table that links the Contact and the Opportunity entities and I don't have any examples or guidance to modify this type of column that I could share.

    • #4
      Hello

      telecastg i will give you a sample
      https://github.com/espocrm/espocrm/b...ields/teams.js

      when you create a user, and add teams to user, it's a enum.. so just replicate
      (for information.. i have not skill but it's possible for me)

      Beste Regards

      Comment


      • rabii
        rabii commented
        Editing a comment
        hey @item

        Thanks for sharing this with me, i have looked at it and teams is just a many to many relationship field between users and teams there is no additional fields in the pivot table. what i need is a way to allow each contact on opportunity to have multiple roles rather then just one role e.g a contact could be (decision maker - influencer) at the same time.

    • #5
      Hello item

      I think that this is a very good example, thanks for the tip!

      rabii maybe you can check it and adapt for the Contact Role field.

      Comment


      • rabii
        rabii commented
        Editing a comment
        it is not what i am looking for this is just a basic many to many relationship field between two entities without any additional columns / fields on the pivot table.

    • #6
      @rabbi Did you manage to solve the issue? I have the same situation, and I can't display a multiEnum select. I changed the Role field to multiEnum, but I can't get it to display. Thank you for any hint.

      Comment

      Working...
      X