I am trying to write a visual force page with extension to show the Parent records on a child record. In this situation, many cases (custom child object) are associated with Products(parent lookup). Also, many parent products may have the same cases associated with them.

I can display the cases associated to products in the related list. But the use case requires the parent products to be visible at the child level.

controller code:

public class CaseParentExt {

    public List<L1dlF0rm0rg__ICIX_Product__c> prods {get;set;}

    public static L1dlF0rm0rg__Case__c.Id caseId;

    public CaseParentExt()
        //line 9:           
        prods = [ SELECT Id, Name FROM L1dlF0rm0rg__ICIX_Product__c where  Id = :caseId];
    return prods.Id

Error I am receiving:

Line 9: sObject type 'L1dlF0rm0rg__ICIX_Product__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

  • What package uses the namespace L1dlF0rm0rg? Are you sure the ICIX_Product__c object exists in that namespace? Also, the type for caseId should just be Id, not L1dlF0rm0rg__Case__c.Id. Also, your return statement isn't contained within the scope of a function. Also, you don't have a semicolon terminating the line with the return statement.
    – Adrian Larson
    Dec 21 '16 at 8:06
  • @AdrianLarson Ok, I have fixed a few things, the namespace issue, the sObject.Id issue, and the return terminating issue.
    – Jason
    Dec 21 '16 at 9:08

If it is a lookup you can query the fields required directly:

[Select L1dlF0rm0rg__ICIX_Product__c, L1dlF0rm0rg__ICIX_Product__r.Name From Case Where Id = :caseId]

this gets you the ID and the Name.

Lookup fields from the parent are singular and not queried like related lists.

  • I have revised the select statement to reflect yours. Now I am getting the error Initial term of field expression must be a concrete SObject: List<ICIX_V1__ICIX_Product__c> on line 9: prods = [ SELECT L1dlF0rm0rg__ICIX_Product__c, L1dlF0rm0rg__ICIX_Product__r.Name FROM L1dlF0rm0rg__Case__c where Id = :prods.Id]; I am going to take a stab and say its because its a list and I need to just put it as public?
    – Jason
    Dec 21 '16 at 9:08
  • @Jason most likely because you are doing prods.id when prods is a list
    – Eric
    Dec 21 '16 at 13:22
  • I changed out the prods.Id to just prods, now I am getting an Invalid Bind expression? Invalid bind expression type of ICIX_V1__ICIX_Product__c for column of type Id Line 7 (Select Statement.)
    – Jason
    Dec 21 '16 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.