OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions Dynamic enum with extension

This topic contains 4 replies, has 3 voices, and was last updated by  dawid.zaroda 5 years, 6 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #37529

    mlukaszewicz
    Participant

    Hello Dawid,

    When you create new enum type you are in fact creating new entity and a relation to it.

    In your case I can suggest 3 possible solutions:

    1) create new enum type and use it. You can add some values during the migration and later on through UI/migrations.
    2) create many-to-one relation from Account to your entity instead of enum
    3) if for some reason you want to create enum and sync it’s values with your entity you can do this using postUpdate/postPersist events on Account add/update your enum field values.

    Please tell me if you have any additional questions.

    Best,
    Martin

    • This reply was modified 5 years, 6 months ago by  mlukaszewicz.
    #37531

    dawid.zaroda
    Participant

    Hello Martin,

    thank you for response. I chose option number 2 and added many-to-one relation. But problem is, that I can not add any additional conditions, like “don’t pick deleted rows”. My code:

    Can you help me with that, please?

    Best regards,
    Dawid

    #37532

    Yevhen Shyshkin
    Participant

    Hello, Dawid.

    If I understood you correctly you want to restrict list of entities you’d like to see at you entity dropdown. The easiest solution for that is to create custom form type (probably autocomplete) and add your restrictions there. Then you can set your form type to entity field configuration, so application with use it instead of the default form type.

    Here is example of how it can be done:

    Pretty good example of such functionality is available here.

    #37535

    dawid.zaroda
    Participant

    Hello Yevhen,
    thanks for your help – it works.

    Regards,
    Dawid

Viewing 4 replies - 1 through 4 (of 4 total)

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top