You need to sign in to do that
Don't have an account?
ledap13
How do I get the Id from the list?
Here is my code:
public void selectProductsByTariff(){
system.debug( 'Start ' + myOpportunity.Id );
tariffName = System.currentPageReference().getParameters().get('Tariff');
system.debug( 'Tariff: ' +tariffname);
listTariff_Bundles = [SELECT Name, (SELECT Id, Name, Product__c FROM Product2Tariff__r) from Tariff_Bundles__c WHERE Name = :tariffname LIMIT 1];
for (Tariff_Bundles__c master : listTariff_Bundles) {
System.debug('Here is an ObjectMaster record: '+master);
for (Product2Tariff__c detail : master.Product2Tariff__r) {
object productId = detail.get('Id');
myProduct = [SELECT Id, Name from Product2 where Id = :productId]; (invalid bind expression type of object for column of type Id)
System.debug('Here is an ObjectDetail record: '+productName);
}
}
}
Please help me!!
public void selectProductsByTariff(){
system.debug( 'Start ' + myOpportunity.Id );
tariffName = System.currentPageReference().getParameters().get('Tariff');
system.debug( 'Tariff: ' +tariffname);
listTariff_Bundles = [SELECT Name, (SELECT Id, Name, Product__c FROM Product2Tariff__r) from Tariff_Bundles__c WHERE Name = :tariffname LIMIT 1];
for (Tariff_Bundles__c master : listTariff_Bundles) {
System.debug('Here is an ObjectMaster record: '+master);
for (Product2Tariff__c detail : master.Product2Tariff__r) {
object productId = detail.get('Id');
myProduct = [SELECT Id, Name from Product2 where Id = :productId]; (invalid bind expression type of object for column of type Id)
System.debug('Here is an ObjectDetail record: '+productName);
}
}
}
Please help me!!
object productId = detail.get('Id');
with
Id productId = detail.Id;
Has worked.
Can you please explain to me how myproduct.name from can create a list?
Thank you