I’m trying to achieve something that would seems doable, even if slightly difficult, but I just can’t make it work at all and any pointers would be greatly appreciated.
Here’s the simplified use case:
Two collections:
Users
Providers
The following relationships are set: Users:
Recommendations (Providers): Users can Recommend providers and their recommendations are listed here
Following (Users): Users can follow other Users
Manages (Providers): Users can manage Providers
Providers:
Managed by (Users): The user who manages the page.
Recommenders (Users): Users who recommended the page
Screens: Home:
List of Providers, when clicked on one, go to the Provider Profile Screen and send Current Provider data.
Provider Profile Screen:
Displays information about the Current Provider, as sent from the Home screen, along with a “Recommend” button for Users to Recommend the Provider.
What I am trying to achieve:
When the Recommend button is clicked, add the “Managed by” user(s) for the Current Provider to the “Following” users of the Logged-In user.
I can’t seem to do that however as all I have to add in that field is the Logged-In user.
For info:
I can access the “Managed By” field for the Current provider on that screen to display the list of “Recommendations” made by the user(s) listed in the “Managed By” field. I am at a loss as to why I can’t access the “Managed By” field to update the Logged-in user
I’m actually very familiar with these tutorials as I implemented a simple follow function as well.
Unless I’m missing something, what I want to achieve is different though, as contrary to that tutorial, I am not adding a User as a follower on a page where there is a “Current User” but on a page where there is a “Current Provider”, which has a field where a user appears.
I tried to explain in details in the first message but I cannot get the user specified in that field
It sounds as though you will need to make the recommend button a list so that you would have that data available, then filter down that list to be from the current provider.
For future readers who want to accomplish the same thing:
I turned the Recommend button into a list of users, filtering based on the Current Provider then Managed by (which is the user field I wanted to access)
Then in the actions when that list item is clicked, I add the Current user to the Following field for the Logged-In user
Be careful: I was confused for a while as my click actions on the list didn’t seem to register but I realized I was still applying the click actions form the list and not from the (now list item) button. So be mindful of that!