question

Kim Strasser avatar image
Kim Strasser asked

How can I use CustomTags?

I'm trying to use CustomTags in Rules but it never works.

My client code:

var result = await PlayFabClientAPI.PurchaseItemAsync(new PurchaseItemRequest()
{
    CatalogVersion = shopname,
    ItemId = itemid,
    Price = itemprice,
    VirtualCurrency = itemcurrency,
    CustomTags = new Dictionary<string, string>() {
    {"Playertag", "0"}
    }
});

I want to execute a Cloud Script function after the purchased item is added to the player's inventory. But the Cloud Script function should only be executed if the item's "Playertag" is "0". For example, if it is "3", then the Cloud Script function should not be executed.

I get the following PlayStream event:

{
    "EventName": "player_inventory_item_added",
    
    "BundleContents": null,
    "EventNamespace": "com.playfab",
    "EntityType": "player",
    "Source": "PlayFab",
    "TitleId": "E5E2C",
    "EntityId": "4BA00A0BDD80CDE6",
    "EventId": "c939d09768be437d9551ae5fe7caad66",
    "SourceType": "BackEnd",
    "Timestamp": "2021-03-29T12:25:14.4675159Z",
    "History": null,
    "CustomTags": {
        "Playertag": "0"
    },
    "Reserved": null,
    "PlayFabEnvironment": {
        "Vertical": "master",
        "Cloud": "main",
        "Application": "mainserverlinux",
        "Commit": "fd683bf"
    }
}

And I have this rule:

But the rule is never executing my Cloud Script function, even if the item's "Playertag" is "0". What am I doing wrong?

Is something wrong with the rule's condition?

CloudScript
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

·
Seth Du avatar image
Seth Du answered

We have submitted a report to the corresponding team and will keep you informed when there is any feedback.

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.