Leaderboard list by user ids is returning global records instead

The returned records are the same as if no owner_ids were provided. I also tried removing the 10 record limit but it didn’t change anything.

I’m using this code on the client side.

 let result = await backend.client.listLeaderboardRecords(backend.session, target_board, ownerIds, 10);
if (result && result.records) {
    console.log("Fetched records. %s", JSON.stringify(result.records));
    return result.records;
} else {
    console.error("Could not fetch leaderboard entries from backend.");
    return null;
}

The list of ower_ids is something like [b2e7b3d8-8246-4c01-b0bc-fc729347ae11,014fb9ea-df8b-4682-bcff-b7eff92f85d5] of the type Array.

I’m not sure what I’m doing wrong, is it possible the owner ids needs to be of a specific object type?

With No provided owner ids:

With Provided owner ids:

@asheraryam In the JS client you should look at the owner_records field for results which come from the listLeaderboardRecords API request. :+1:

1 Like

Thank you that works!

I saw “owner_records” several times in the docs but I just assumed it’s a copy of owner_ids I passed. :sweat_smile:

I had already given up after several hours and was considering scrapping the friends leaderboard altogether :b

We’ll try to make it clearer in the docs but I’m glad you’ve got it solved.

The reason we return both records and owner_records is because some mobile games like to display a leaderboard view which shows you, your friends, and the top X number of players on the leaderboard. So we give the option in the API response to bundle the two sets of data together. :+1:

1 Like

That’s definitely good design and I might use that in the future so I’m glad it’s an option :smiley:

1 Like