Bookmark/favorite features on a post.

0
Hi there,   I want to create a feature on an event management app where the user can bookmark/favorite events. I have created a relationship on the domain model that connects the user and event entity. In addition, I have created a microflow that you can see below on the screenshot.  In the preview, the microflow works to the extent of showing me a ‘successful message’. However, I have not been successful on showing the events that has been bookmarked on the designated page. In addition, I am still struggling to find a way to change the bookmark button from unfilled to filled when bookmarking an event. Any ideas how to solve this?   Thanks in advance!
asked
2 answers
1

Hi Anisa,

I have done something comparable in the past. I always used an extra entity between (in your case) the event entity and the user entity. I call this entity Favorite.

 

I have a screen defined with two parts, one with an list of events and one with a datagrid of all favorites and it looks something like this:

The mendix page definition is like this:

Left you see a grid of all the events, with a listener to add, edit and delete events. I’m not explaining this part as it is standard mendix. The interesting part is in the Favorite dataview. I get the data based on a microflow: GetFavorite

This microflow will return a Favorite Object. If it is found based on a retrieval (see later) it returns the found record or a new record (ofcourse with IsFavorite set to false).

In the dataview I show the a button Make Favorite with visibility when isFavorite = false and a button Unmake Favorite with visibility when isFavorite = true

 

The retrieval is as follows:

 

The behaviour of the buttons are basically switch the isFavorite value, shown the microflow to Make a Favorite

In the second part of the page I show only the favorites for the current user and isFavorite = true (see data source)

 

This is a standard favorites solution. Hope this will help. If so, please accept my answer on the forum. I have not included deletion rules on the associations and any access rules. This should be included to make it more in line with standard / secured solution

 

 

answered
0

Hi Anisa,

It looks like you have a custom User entity configured. This is in no way connected to the current user yet. Instead, you should make an association between Event and the System.User entity. You can then create a datagrid for Events on the page with an XPath that constrains the events to display with the Event.Favorite_User = [%currentUser%] assocation.

Hope that helps!

answered