• #29586
     Anjali #7
    Forcetalks

    Define error: “Initial term of field expression must be a concrete SObject: LIST ” in Salesforce

    What kind of error is “Initial term of field expression must be a concrete SObject: LIST<User> “

     

    #33177
    Forcetalks

    Hi Anjali,

    The reason for this kind of error may be  comparison of  list with single sobject because list is a collection of data ,you can’t compare with it single sobject .

    For example, in the code below  we query the set of users [into list variable user}for which  ManagerId with a new Id are updated and then adding it to TrsfrMgr list. The assignment to update manager Id  is not working because of the difference in the data type. When we retrieve using Name, we are defining ToMgrID as a List<User>. Whereas in the suggestion by codeinprogress, the ToMgrID was defined with data type as Id. In this code ToMgrID[0].Id would have worked as it would use the first record from the list.

    List<User> FromMgrId ,ToMgrID ;
    ToMgrID = [select Id from User where name=: ToMgr] ;
    for (User a : user)
    {
    system.debug(‘OLDMgrId’ + a.ManagerId);
    a.ManagerId = (ID) ToMgrID.Id;
    TrsfrMgr.add(a);
    }

    Hope it helps.

     

     

     

    #38127
    Salesforce | Parul Parul #2
    Forcetalks

    The reason for this kind of error may be  comparison of  list with single sobject because list is a collection of data you can’t compare with it single sobject .

     

Viewing 3 posts - 1 through 3 (of 3 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?