通过APEX代码共享

时间:2013-05-01 06:41:04

标签: salesforce

当我执行下面的代码时,我得到了无效的Bind Expression。如果我犯了任何错误,有些人会解释我。

public void ShareAPRwithAdvisor(List aprs){

    List<APR__Share> APRShareList = new List<APR__Share>();
    List<APR__c> apraccList=new List<APR__c>([SELECT id,APR_AdvisorName__c FROM APR__c WHERE Id IN:aprs]);
    List<Account> usrlist=new List<Account>([SELECT id,Advisor_User__pc FROM Account WHERE Id IN:apraccList]);

    System.debug('APR********************'+aprs);
    // System.debug('APR********************'+aprs.APR_AdvisorName__c);

    for(APR__c apr : aprs){
         if(apr.APR_AdvisorName__c != null){
            APR__Share aprshare = new APR__Share();
            aprshare.ParentID = apr.ID;
            aprshare.UserorGroupID = usrlist.Advisor_User__pc;
            aprshare.AccessLevel = 'Edit';
            APRShareList.add(aprshare);

        }
        System.debug('APRShareList'+APRShareList);
    }

1 个答案:

答案 0 :(得分:0)

“usrlist.Advisor_User__pc” - 这不应该是“usrlist.Advisor_User__c”吗?