Access a enum value from formula

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nkarlen
    Junior Member
    • Mar 2022
    • 2

    Access a enum value from formula

    Hello,

    I didn't found any post in this problem I found.

    I'm trying to fill a custom Lead field value and I need to get the value of the salutationName field which is an enum.
    When I write salutationName or entity\attribute("salutationName"), I get the key of the enum but not the value. ex: "Mr." instead of "Sir".

    Is there any way to get the value of the enum from the formula editor ?

    Thanks !
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    Could you provide the formula, you are using

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      Use language\translateOption https://docs.espocrm.com/administrat...ranslateoption

      We call it 'label', not 'value'.
      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

      • nkarlen
        Junior Member
        • Mar 2022
        • 2

        #4
        The formula :
        ifThenElse(string\length(string\trim(salutationNam e)) > 0,
        salutationPhrase = string\concatenate(" ", language\translateOption(entity\attribute("salutat ionName"), "salutationName", "Lead"), " ", lastName),
        salutationPhrase = "")

        Thank you yuri, I had tried this option but it didn't give me the right result, maybe the scope argument. Now it's good.

        Comment

        Working...