Voting is a must when you need to decide:

  • Which questions you will discuss at the meeting
  • Which tasks are urgent
  • Who will go to the Friday party
  • Who is the Weakest Link

Use Voting to prioritize features, estimate stories in Sprint and see, what your team loves and what is bullshit.

What are we going to map?

Well, imagine, you are having a party. What is the main thing at the party? Food! Of course, each of your teammates is a critic hedonist, so choosing meals becomes a real challenge.

This is how it will look like!


Cool, right?

Well, for this case let's create a new App.

Setting up an App Structure

  • Create a New App and add Type

Let's create a new App. This is not a must, but we don't have a good template for this case. And add a new Type there - Meal.

  • Set the Relations

Here we need to build a many-to-many relation between created Type (Meal) and Fibery Users. Why many-to-many? Because we want Users to have a chance to vote for multiple Meals, not only one.

Note: Users - buddies from the People App - already logged into the workspace teammates.

  • Add necessary fields

The main field required is Action Button

Here comes some magic. We're on our way to unlock the power of automation to no-code creators, but so far programming action buttons require some coding skills. But we already have a repository with already written codes. Here is the code, you need for Voting. Just copy and paste this code inside the Action Button field.

const fibery = context.getService('fibery'); 

const FIELD_NAME = 'Upvoters';

await Promise.all(
args.currentEntities.map(async e => {
const entity = await fibery.getEntityById(e.type, e.id, [FIELD_NAME]);
const userId = args.currentUser.id;
const usersCollection = entity[FIELD_NAME].map(({ id }) => id);
const methodName = usersCollection.includes(userId) ? 'removeCollectionItem' : 'addCollectionItem';
return fibery[methodName](e.type, e.id, FIELD_NAME, args.currentUser.id);
})
);

Here is how it will look in Fibery.

Done 🧐

Note!
If you called a relation, not "Upvoters" (you were more original), then, after copy-and-pasting the code, you should replace "Upvoters" with your Field name.

Adding some dummy data

Let's add some Meals to die vote for.

(Someday we will hire a good writer and I will not be longer ashamed of the content)

View Configuration

In fact, here we need only one kind of View - a Voting Page.

I suppose ordinary Table View will be the best choice

So, here is how it works

Tips and Cons

  • Deleting the Vote

Push the same button once again - and the user will disappear (it will work as unvoting). But to avoid the mess, you can one more button and call it Unvote. The JS code will be the same.

Thanks for the reading, guys! If you have better ideas of how to manage it - feel free to share it here or in our Community! Don't hesitate to throw us questions in the Intercom chat, if smth is not clear.

Did this answer your question?