• PhilM
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi,
Can anyone please help me convert the below to JSON:

@AuraEnabled
  public static List<Energy_Plan__c> getRatePlans(
    String brand,
    String priceBook,
    String commodity,
    String utility,
    Boolean showPoints
  ) {
    System.debug('Inside getRatePlans');
      List<Energy_Plan__c> String query =
      'SELECT Id, Name, TermInMonths__c, REP_Per_Usage_Charge1__c, MonthlyFee__c, jurisdiction__c, ProductName__c, ' +
      'EFL_ENGLISH_LINK__c, EFL_SPANISH_LINK__c, PenaltyAmount__c, PlanType__c, Price_Units__c, Rateplan_Points__c,  ' +
      'Monthly_Fee_Total__c, ReportGroupID__c, Commodity__c, Brand__c, EnergyProvide__c,Active__c, UtilityName__c, Total_Fee__c, REPKey1__c, ExternalId__c, ' +
      'TOSLINKSTATIC_English__c, TOSLINKSTATIC_Spanish__c,External_Plan_Key__c ' +
      'FROM Energy_Plan__c ' +
      'WHERE ' +
      'Active__c = true ' +
      'AND IsCustomPriced__c = False ' +
      'AND Brand__c = :brand ' +
      'AND RateName__c = :priceBook ' +
      'AND Commodity__c = :commodity ' +
      'AND UtilityName__c = :utility ';

    if (showPoints) {
      query += 'ORDER BY Rateplan_Points__c DESC';
    } else {
      query += 'ORDER BY Name';
    }

    System.debug('getRatePlans >> ' + Database.query(query));

    return Database.query(query);
  • June 23, 2022
  • Like
  • 0