Forums

Covering OroCommerce, OroCRM, OroPlatform topics, including community updates and company announcements.

Forums OroCRM OroCRM – How do I? Questions Create Calendar Events from Another Entity's Controller

This topic contains 2 replies, has 2 voices, and was last updated by oro_newbie oro_newbie 8 months, 1 week ago.

  • Creator
    Topic
  • #29490
    oro_newbie
    oro_newbie
    Participant

    Hi,

    I would like to create calendar events from the Case Entity (I know you can add tasks but I have a custom field with the case entity – follow up date & follow up action using which I would like to create a calendar event everytime it’s updated).

    I think there are different ways to this?

    1. Try to make use of the Calendar Event’s form handler
    2. Make use of the workflow action used to create the calendar event (programmatically)
    3. Add the calendar event directly to the database – I would prefer this but in this case I do not know how to add the reminders and the context.

    Can anyone please advise?

    Thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #29491

    igalayev
    Participant

    Hi,
    yes you can add a listener which will add calendar event into Db when Case entity’s fields are changed.

    Please note that CalendarEvent entity implements RemindableInterface which allows you to add reminders invoking setReminders method:

    To add context you need to use ActivityManager. You can take a look at form handler to figure out how it works while processing the form.
    So just invoke this method with the right parameters. In your case it would be something like:

    #29492
    oro_newbie
    oro_newbie
    Participant

    @igalayev

    Thank you so much! Your advise worked perfectly. Here’s the code if anyone’s still stuck:

    1) Create a Listener for your bundle (FollowUpListener in my case):

    2) Add to services.yml:

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

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No
ssossossossossosso