question

jonathan375735 avatar image
jonathan375735 asked

currentEntity vs callingEntityKey in cloud script context

Hello,

Just wondering what the difference is. I can't find any documentation for: context.callingEntityKey. All I have to go on is the name which is somewhat self explanatory however how does it differ from context.currentEntity and when would a use the one over the other?

Thanks,

Jonathan

CloudScript
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.

jonathan375735 avatar image jonathan375735 commented ·

BTW: it should be currentEntity.Entity vs callingEntityKey. I'm aware that currentEntity contains much more information.

0 Likes 0 ·

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

I assume that you’re referring to the “context” parameter passed by CloudScript when calling the ExecuteEntityCloudScript API. In fact, these two fields are different:

currentEntity.Entity refers to the entity that’s been performed action on, in other words, it’s the entity specified in ExecuteEntityCloudScript’s request body:

https://docs.microsoft.com/zh-cn/rest/api/playfab/cloudscript/server-side-cloud-script/executeentitycloudscript?view=playfab-rest#request-body

callingEntityKey is associated with the caller’s entity, for instance, when calling ExecuteEntityCloudScript using the title’s entity token, callingEntityKey would be the that title’s EntityKey, like this:

"callingEntityKey":{

"Id":"xxxx",

"Type":"title",

"TypeString":"title"

}

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.

jonathan375735 avatar image jonathan375735 commented ·

Thanks. I was calling `ExcuteEntityCloudScript` without passing `Entity`. So it was defaulting to the calling entity which is what I wanted. But this made the distinction unclear.

Thanks you,

Jonathan

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.