美文网首页
2020-06-15 常见问题汇总 -1

2020-06-15 常见问题汇总 -1

作者: 古月的小七 | 来源:发表于2020-06-15 16:44 被阅读0次
    1. System.QueryException: List has no rows for assignment to SObject
    Player__c player = [SELECT Id from Player__c where Name = :username];
    if (player != null)
     p = player.Id;
    

    这个问题是由于没有Record返回时造成的,解决方案如下:

    List<Player__c> players = [SELECT Id from Player__c where Name = :username];
    if (players.size() > 0)
    p = players.get(0).Id;
    

    2.Your attempt to delete could not be completed because it is associated with the following relationships with other objects.
    这个问题是由于在 Object 上删除了 Lookup 的 field之后,需要在进一步的操作才可以完全删除,解决方案如下:
    Try going into the object where you deleted the lookup field, and you will see "Deleted Fields". Click that to then fully ERASE the field. You should be able to delete the previously related objects.

    相关文章

      网友评论

          本文标题:2020-06-15 常见问题汇总 -1

          本文链接:https://www.haomeiwen.com/subject/wblhxktx.html