Hot answers tagged

3

Your query is missing the querying of the related record likely called Installed_Product__c. The field Installed_Product__c is just the Id of that record. To get fields from that object you will need to include _r references e.g. Installed_Product__r.Status__c in the query. If you haven't already, I suggest you work through e.g. Write SOQL Queries, focusing ...


2

Every field you want to read must be in the SOQL query. The if condition checks the value of Installed_Product__r.Status__c, so that field must be added to the query in the first list of the snippet: List<Service_Contract_Products__c> coveredProducts = [SELECT Id, Installed_Product__c, Installed_Product__r.Status__c FROM Service_Contract_Products__c]; ...


2

Unfortunately apex doesn't handle list-level type conversion so if "obj" is a List<Object> and even if each Object is actually a String you still cannot convert that list directly to a List<String> via type casting. You have two options. First is to do a loop: List<Object> obj = ...; List<String> objAsStrings = new List<...


Only top voted, non community-wiki answers of a minimum length are eligible