I just started programming in apex, so I will appreciate your help in this case. This class should allow me to get the bundle_Items from bundle object where Bundle__c =(Here is the result of the 'values', which returning the correct Ids, I already tested it). I don't know if I am doing something wrong in the second query, or there might be another approach for the IN: values.
"Error: Compile Error: Invalid bind expression type of SOBJECT:Purchase_Order_Details__c does not match domain of foreign key at line 19 column 79"
Thank you so much in advance!
public class PO_Vendor_Controller_BundleItems {
public ApexPages.StandardController std2;
public List<o_Bundle__c> PODetails2 {get; set;}
Public List<Purchase_Order_Details__c> values {get;set;}
public PO_Vendor_Controller_BundleItems (ApexPages.StandardController stdCtrl2){
std2=stdCtrl2;
List<Purchase_Order_Details__c> values = [SELECT ProductId__c
FROM Purchase_Order_Details__c
WHERE PO_ID__c =:std2.getId()];
String[] contractIDs = new string[values.size()];
for (integer i=0; i<values.size(); i++){
contractIDs[i] = values[i].ProductId__c;
}
PODetails2 = [SELECT Bundle_Item__c
FROM o_Bundle__c
WHERE Bundle__c IN:contractIDs ];
}//END init(ApexPages.StandardController stdCtrl2)
}//END PO_Vendor_Controller_BundleItems
Update - above Constructor
updated