hello i would like to create a group and put the user who created it as admin i use entity.createGroup(groupName) but it puts the id of my project as admin of the group
hello i would like to create a group and put the user who created it as admin i use entity.createGroup(groupName) but it puts the id of my project as admin of the group
You may try specifying the Entity parameter of the CreateGroup API. And please remember to use ExecuteEntityCloudScript API (https://learn.microsoft.com/en-us/rest/api/playfab/cloudscript/server-side-cloud-script/execute-entity-cloud-script?view=playfab-rest) to execute the Cloud Script function so that function will be provided with entity profile. Below is my working Cloud Script code.
handlers.CreateGroup=function(args,context)
{
var entityProfile = context.currentEntity;
var result= entity.CreateGroup({
Entity:entityProfile.Entity,
GroupName: args.groupname
});
}
In addition, if you are using ExecuteCloudScript instead of ExecuteEntityCloudScript, you could refer to https://community.playfab.com/questions/42193/cloudscriptexecuteentitycloudscript-vs-clientexecu.html to have more information about the difference between these two APIs.
2 People are following this question.