question

eriksombroek avatar image
eriksombroek asked

CallerEntityProfile.Lineage undefined

I'm using playfab together with Azure Functions. I have scheduled my Azure Function to execute on the rule com.playfab.player_added_title. My goal is to assign default data to the UserData on the moment the account is created. However most of the time there is no CallerEntityProfile on the context (im using: const playerId = (context as any).CallerEntityProfile.Lineage.MasterPlayerAccountId; )

What would be the correct way of achieving this using typescript?

apisCloudScriptPlayStream
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

·
Xiao Zha avatar image
Xiao Zha answered

Since you use the classic player event “player_added_title” to trigger the function with a rule , you should use PlayerPlayStreamFunctionExecutionContext and the PlayerPlayStreamFunctionExecutionContext doesn’t have the “CallerEntityProfile”. And if you want to assign default data to the UserData with MasterPlayerAccountId, you can use “context.PlayerProfile.PlayerId”.

If you use the entity event to trigger the rule, you may use EntityPlayStreamFunctionExecutionContext, and use “context.CallerEntityProfile.Lineage.MasterPlayerAccountId” to obtain the MasterPlayerAccountId.

For more information about the context model, you may refer to PlayFab CloudScript using Azure Functions Context Models - PlayFab | Microsoft Learn. And for more information about entity event, you may refer to PlayStream with entity events - PlayFab | Microsoft Learn.

10 |1200

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

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.