I need to update user inventory item custom data through cloud script from the client side. The function parameter are the item id and checks with the item id in the user inventory if it matches update the current instance with the particular custom data. While i using this script it's always going to the else part and it givesthe error i attached with the image. handlers.UpdateUserInventoryItemCustomData = function (args, context) { var inventory = server.GetUserInventory({ PlayFabId: currentPlayerId }); for (var i=0; i<17; i++) { var itemInstance = inventory.Inventory[i].ItemInstanceId; var itemid = inventory.Inventory[i].ItemId; if(args.p1 == itemid) { var UpdateSquadRequest = server.UpdateUserInventoryItemCustomData({ PlayFabId: currentPlayerId, ItemInstanceId : itemInstance, Data : { Playing : "1", Order : "1" } }); } else { var UpdateSquadRequest = server.UpdateUserInventoryItemCustomData({ PlayFabId: currentPlayerId, ItemInstanceId : itemInstance, Data : { Playing : "0" } }); } } server.UpdateUserInventoryItemCustomData(UpdateSquadRequest); }