Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Carl Winder · Oct 21, 2020 at 03:08 PM · CloudScript

CloudScript AddSharedGroupMembers

I'm trying to create a shared group in CloudScript after 2 players have matched in matchmaking.

handlers.gameHostCreateGroup = function (args, context) {
    var groupId = args.group_id;
    var members = args.members;
    log.info(members[0].id);

    var createSharedGroupRequest = { SharedGroupId: groupId };
    server.CreateSharedGroup(createSharedGroupRequest);

    var updateSharedGroupDataRequest = { 
        SharedGroupId: groupId, 
        Data: {
            'network': args.network
        } 
    };

    server.UpdateSharedGroupData(updateSharedGroupDataRequest);

    var playFabIds = [];

    for(var i = 0; i < members.length; i++) {
        playFabIds.push(members[i].id);
    }

    var addSharedGroupMembersRequest = {
        PlayFabIds: playFabIds,
        SharedGroupId: groupId
    };

    server.AddSharedGroupMembers(addSharedGroupMembersRequest);

    return { 'status': 'OK' };
};

The id property on the members array is the ID from the EntityKey from the login result.

However, when I try and call AddSharedGroupMembers I get the error

"code":400,
"status":"BadRequest",
"error":"AccountNotFound",
"errorCode":1001,
"errorMessage":"User not found"

I'm using CustomLogin with CreateAccount = true at the moment for testing purposes.

I'm guessing the entity key ID is not the same as a PlayFabId

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Citrus Yan · Oct 22, 2020 at 06:08 AM

I believe you’re using ids from this section:

https://docs.microsoft.com/en-us/rest/api/playfab/client/authentication/loginwithcustomid?view=playfab-rest#entitykey

which is the id of the title player account. In your case, you should use PlayFabId instead, which is also returned from login calls:

https://docs.microsoft.com/en-us/rest/api/playfab/client/authentication/loginwithcustomid?view=playfab-rest#loginresult

Comment

People who like this

0 Show 4 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Carl Winder · Oct 22, 2020 at 08:24 AM 0
Share

Ahhh this won't work in my scenario because it's for creating a group once match making has succeeded.

Thanks for your help.

avatar image Citrus Yan ♦ Carl Winder · Oct 22, 2020 at 08:33 AM 0
Share

So you're using ids from matchmaking results?

avatar image Carl Winder Citrus Yan ♦ · Oct 22, 2020 at 08:35 AM 0
Share

Yeah, I'm doing research into PlayFab, so I was basing some of it on the Bumble Rumble sample from the PlayFab Samples repo.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    Disable GitHub Integration 2 Answers

    Saving data in Unity on Pause/Quit/Lose Focus 1 Answer

    ailed to import package with error: Couldn't decompress package 1 Answer

    Was the "CloudScript execution API requests issued" limit raised to 15? 1 Answer

    CloudScript execution? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges