question

Jade Bourque avatar image
Jade Bourque asked

AcceptGroupApplication is not a function ?

I'm trying to accept an application to a group via cloudscript but I'm being returned an error -

entity.AcceptGroupApplication is not a function\n    at handlers.acceptGroupApplication (4882C-main.js:35:25)\n    at Object.invokeFunction (Script:117:33)"



Here's my code - What am I doing wrong, here?

handlers.acceptGroupApplication = function (args, context) {
    var entity = args.Player;
    var group = args.Group;
    
    var result = entity.AcceptGroupApplication({
        "Entity": entity,
        "Group": group
    });
    
    return result;
}
CloudScriptentities
10 |1200

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

Seth Du avatar image
Seth Du answered

The error indicates that AcceptGroupApplication API is not supported in Cloud Script environment. However, in the common scenario, AcceptGroupApplication is not necessary to be implemented in Cloud Script because only Admin Role or customized Role with modified policy can accept the application.

If you have specific requirement, please migrate to Azure Function.

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.

Jade Bourque avatar image Jade Bourque commented ·

Thank you for your reply, I'll take a look at Functions.

Is there any particular reason why this API isn't supported in cloudscript? Up 'til this point I've never had an issue with an API listed in the Docs not being supported in cloudscript, It's strange that the other group APIs work but this one doesn't.

0 Likes 0 ·
Jade Bourque avatar image
Jade Bourque answered

New issue. Unsure if I should post a separate question or continue here. Putting details here but if I should make a new post please let me know.

I'm getting an error code 500

Registered a new function with URL :

POST https://titleId.playfabapi.com/Group/AcceptGroupApplication
and used parameters -
"FunctionParameter":
    {
        "Entity":
        {
            "Id": "C8533EE1B30D78DB",
            "Type": "character"
        },
        "Group":
        {
            "Id": "DCC31A0662A7DBA3",
            "Type": "group"
        }
    }

With "Entity" being the character that sent the application request. Should it instead be the character who is accepting the application?

I'm also a wee confused about "the entity to perform the action on". Again, is this supposed to be the key of the character that sent the request or the key of the character that is accepting the request?

I know for a fact I'm having issues because of ignorance, this is my first run-in with Functions, I've only used cloudscript previously

3 comments
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

Azure Function doesn't work like that and it is required to follow this tutorial to implement your function --PlayFab CloudScript using Azure Functions - PlayFab | Microsoft Docs.

In addition, the entity property in the request of AcceptGroupApplication is the candidate in the application pending list. Since all members in your group is character, you need a character type entity token to call AcceptGroupApplication API (otherwise permission related error will prompt).

By default, login API only returns a title-player account entity token, and you need to use session ticket to call GetEntityToken API. Please note that you need to input Character Entity Key in the request to obtain the token, the response will be like:

{
    "code": 200,
    "status": "OK",
    "data": {
        "EntityToken": "xxxxx",
        "TokenExpiration": "2022-01-12T02:44:19.728Z",
        "Entity": {
            "Id": "xxxxxxxx",
            "Type": "character",
            "TypeString": "character"
        }
    }
}

Title player account will be more convenient, and may I ask the scenario of using character?

1 Like 1 ·
Jade Bourque avatar image Jade Bourque Seth Du ♦ commented ·

Thank you kindly, I think I'm getting a grasp on this now

I'm using this for an MMO-style game build in UE4 (I'm using the PlayFab marketplace plugin), where each of the player's characters should be able to be in a different group.

If all else fails, I can rework the system to use title accounts but this would be a little less than ideal despite it being more convenient.

Thank you again, Seth.

I'll try using the character's entity token in the call. Thankfully I guessed correctly and am already using the application candidate for the entity property.
If I can't figure that out I'll simply convert everything over to use title accounts instead.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Jade Bourque commented ·

I think character should work as it is MMO, however, compared with title player account, there are few limitations on Character. For example, character leaderboard doesn't have Game Manager UI and it cannot change the aggregation method.

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.