Include (Don't Replace) Options In a Multi Enum FIeld

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pablo
    Senior Member
    • Aug 2015
    • 177

    Include (Don't Replace) Options In a Multi Enum FIeld

    Hi!

    We have the following situation:
    • Inside Contacts we have a multi-enum field called "Interests" with different options "TShirts", "Pants", "Shoes".
    • Now, we are creating a workflow where we need to add (include) the interest "Shoes" to the contact, including past interests that the contact had. Example: Pants, Shoes.
    • However, when the workflow executes, it overrides the whole field and only leaves the option Shoes.
    We need to maintain the past interests of the Contact and add the "Shoes" interest to this field.

    Is it possible with a workflow, formula or BPM?

    Thanks a lot!
  • yuri
    Member
    • Mar 2014
    • 8440

    #2
    Hi Pablo,

    Multi-enum fields are implemented as arrays.

    Formula to add values to the multi-enum field while preserving previous ones:

    Code:
    yourEnumField = array\push(yourEnumField, 'New Item');
    https://docs.espocrm.com/administrat...ula/#arraypush
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • Vadym
      Super Moderator
      • Jun 2021
      • 345

      #3
      Hi Pablo,

      Workfolw -> Actions -> Execute Formula Script

      Formula:
      interests = array\push(interests, 'Shoes');
      Last edited by Vadym; 08-06-2021, 07:43 AM.

      Comment

      • Pablo
        Senior Member
        • Aug 2015
        • 177

        #4
        That's the one!
        Thanks a lot yuri and Vadym

        Comment

        Working...