I want to find an item in the Catalog but I'm not sure if it is possible to find an item when I use the displayname to find it.
I get this error message:
"Error": { "Error": "JavascriptException", "Message": "JavascriptException", "StackTrace": "SyntaxError: Unexpected token L in JSON at position 0\n at JSON.parse (<anonymous>)\n at E5E2C-main.js:415:23\n at Array.find (<anonymous>)\n at handlers.GrantingLeaderboardRewardsToPlayer (E5E2C-main.js:413:34)\n at Object.invokeFunction (Script:117:33)" }
var displaynameenglish = "Bamboo Sword"; var request = { CatalogVersion: "MyShop" }; var result = server.GetCatalogItems(request); var itemObj = result.Catalog.find(function (obj) { return JSON.parse(obj.DisplayName).English === displaynameenglish }); // find the item in the catalog var tags = itemObj.Tags;
Is it possible to use the English displayname of the item when I use result.Catalog.find in CloudScript?