question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

GetLeaderboardAroundUser doesn't return PlayFabId - Possible bug?

Hello everyone,

I'm trying to get a random user in Cloudscript depending on the player's experience. I use the code down below to get a random player.

        var getRandomUser = {
            "MaxResultsCount": 50,
            "PlayFabId": currentPlayerId,
            "StatisticName": "Experience"
        };
        var getRandomUserResult = server.GetLeaderboardAroundUser(getRandomUser);

        for(var i = 0; i < getRandomUserResult.Leaderboard.length; ++i) {
            log.info("Index: " + i + " - Name: " + getRandomUserResult.Leaderboard[i].DisplayName + " - ID: " + getRandomUserResult.Leaderboard[i].PlayfabId);
        }

The code works without an issue, however, the PlayFabIDs of the players return as undefined. Is that expected behavior? If so, what should I do to get their PlayFabIDs as well?

This is the one of logs. (The ID is undefined for all the players):

01.jpg (11.5 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Please refer to the API reference -- Player Data Management - Get Leaderboard (PlayFab Client) | Microsoft Docs, the attribute name of PlayFab unique identifier should be “PlayFabId”, not “PlayfabId”, "F" should be capitalized. Could you please modify the corresponding statement, then try it again?

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ozan Yilmaz avatar image Ozan Yilmaz commented ·

It was a typing mistake. It's working now.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.