You need to sign in to do that
Don't have an account?
XIO
Compile Error: Didn't understand relationship 'Products__r' in FROM part of query call.
Hello Developers!
I need assistance with my Apex Class. I'm getting the error below for the Apex Class below. Any assistance will be gladly appreciated!
Error: Compile Error: Didn't understand relationship 'Products__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 16 column 6
I need assistance with my Apex Class. I'm getting the error below for the Apex Class below. Any assistance will be gladly appreciated!
Error: Compile Error: Didn't understand relationship 'Products__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 16 column 6
public class StockroomConfVouchersController { Public List<Product2> Product2List{get;set;} public String contId{get;set;} public String dcid{get;set;} public Product2 Product2Obj{get;set;} Public string editid{get;set;} public Stockroom__c S {get;set;} public Id selectedDetailID { get;set; } String currentRecordId ; public StockroomConfVouchersController (ApexPages.StandardController controller) { currentRecordId = ApexPages.CurrentPage().getparameters().get('id'); S=[SELECT ID,Name,(SELECT ID,Name,Balance__c,Capacity__c,UsedNEW__c,IsActive,Start_Date__c,End_Date__c, Status__c FROM Products__r WHERE Status__c = 'Active') FROM Stockroom__c WHERE ID=:currentRecordId ]; system.debug('ssssssssss'+Product2List); system.debug('uuuuu'+currentRecordId ); if(S==null) { Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,''+'No Confernce Vouchers to Display')); } } public PageReference save() { system.debug('sssssssssssssuuuu'+S); upsert S.Products__r; PageReference pageRef = new PageReference('/apex/StockroomConfVouchers'); pageRef.setRedirect(true); return null; } public pagereference deleteCon() { String s1 = System.CurrentPageReference().getParameters().get('dtlIdParam'); Product2 p=[ select id,IsActive From Product2 Where id=:s1]; p.IsActive = false; upsert p; PageReference pageRef = new PageReference('/apex/StockroomConfVouchers'); pageRef.setRedirect(true); return null; } }ß
It's possible that the child relationship name between your Stockroom object and the Product object is not "Products". To find out what it is, go to Setup > Object Manager > Product and under Fields & Relationships, click on the Field Label for Stockroom. The correct API name should be listed under "Child Relationship Name".
All Answers
It's possible that the child relationship name between your Stockroom object and the Product object is not "Products". To find out what it is, go to Setup > Object Manager > Product and under Fields & Relationships, click on the Field Label for Stockroom. The correct API name should be listed under "Child Relationship Name".