I'm getting this error. I'm not sure how to solve, can anyone help me out. Error: Compile Error: Method does not exist or incorrect signature: void getDescribe() from the type Id a

public class OrderFieldsValidationBeforeERP {
String missingFields = '';
String returnString;
List<String> returnStrings;

@InvocableMethod(Label = 'Check Order Vital Fields' description='Returns the list of account' category='Apttus_Config2__OrderLineItem__c')
public static List<String> orderFieldsCheckBeforeERP(List<Order> orders){ 
    String missingFields = '';
    for(Order ord : orders){
    Order o = [Select Id, Name, ERP__c, Bill_To_CO__c, Ship_To_CO__c, Customer_Order_Type__c, Project_Info__c, 
                                    Apttus_Config2__PODate__c,Apttus_Config2__PONumber__c, Invoice_Account__c, Proposal_Language__c, 
                                    Delivery_Method__r.Dmt__c, Requested_Delivery_Date__c, Sales_Person__c, Incoterm__r.Name
                                    FROM Order WHERE Id = :ord.id ];

    (o.Bill_To_CO__c == null) ? missingFields.add(o.Bill_To_CO__c.getDescribe().getLabel()):null;
    (o.Ship_To_CO__c == null)?missingFields.add(o.Ship_To_CO__c.getDescribe().getLabel()):null;
    (o.Customer_Order_Type__c = null|| o.Customer_Order_Type__c ='')?missingFields.add(o.Customer_Order_Type__c.getDescribe().getLabel()):null;

1 Answer 1


Use Order.Bill_To_CO__c.getDescribe().getLabel()

  • It works thanks Commented May 10, 2022 at 10:31
  • hI @Sneh I have another problem in the conditon part. on the Same line. I'm getting Error: Compile Error: Illegal assignment from Boolean to Id at line 15 column 10 on o.Bill_To_CO__c == null) conditon. Can you help me point out what is wrong in it ? Commented May 10, 2022 at 11:52
  • @Kiran.pandiyan While ternary operators work this way in JavaScript, you can't write shorthand if statements like this in Apex. You have to write them out long-hand: if(...) {...}.
    – sfdcfox
    Commented May 10, 2022 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .