• Luca Pagnotta
  • NEWBIE
  • 5 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 6
    Replies
Looks like Challenge 7 is not working for me.. I tried with 2 separated Playgrounds from the scratch and it still fails with weird error, even though I think I've done everything right. I have no idea what else I should try.

Error message:
There was an unhandled exception. Please reference ID: GFXKWRGA. Error: Faraday::ClientError. Message: BAD_REQUEST: Specify a valid value for the source parameter.
I'm having problems with the Check Challenge on step 6, with regards to the Chatter Group.

I have created the Chatter group and a lightning page to support it. I have been getting this error for the last hour:
User-added image

It's driving me nuts - I've tried everything, even renaming the page. It's quite clearly there.

User-added image

Salesforce is this a bug?
Hi team, 

This is sort of urgent request. I wrote this class which is generating a pdf for an custom object. I wrote my test class however it's not covering anything. I'm not sure what exactly I should be testing for since I still hasn't grasps the idea of the purpose of testing class other than DML statement or returned methods. Below is my apex class and test class. It is passing with (0/0) methods "Selected job is not yet complete".

/******************************************************************************
* Extension for
*/
public with sharing class ExpensePDFController {
   
    /** List of Invoice__c fields that do not exist on the VF page that need to
     *  be referenced elsewhere in the code */
    public static List<String> ADDL_FIELDS = new List<String> {
        'Name',
        'Amount__c',
        'Approved_Date__c',
        'Approved_by__c',
        'Count_Line_Items__c',
        'Date__c',
        'Date_Submitted__c',
        'Status__c',
        'Total_Amount__c'
     };
   
    /** The invoice to generate a PDF for */
    public Expense__c expense {get; set;}
   
    public List<Expense_Line_Item__c> lineItems {get; set;}
   
    public Integer getLineItemsSize() {
        return lineItems.size();
    }
   
    /** Data structure of page parameters */
  //  public Parameters params {get; set;}
   
   
    /**************************************************************************
     *
     */
    public ExpensePDFController(ApexPages.StandardController controller) {
       
        // Add any additional fields
        if (! Test.isRunningTest()) {
            controller.addFields(ExpensePDFController.ADDL_FIELDS);
        }
       
        // Initialize local variables
        Id expenseId = ApexPages.currentPage().getParameters().get('id');
        String fields = ADCUtil_Base.strJoin(',', ADDL_FIELDS, 'Id');
        //expense = (Expense__c) Database.query('SELECT Id, Name FROM Expense__c WHERE Id = :expenseId');
        expense = (Expense__c) Database.query('SELECT '+fields+' FROM Expense__c WHERE (Id = :expenseId) ORDER BY LastModifiedDate DESC LIMIT 1');
        //params  = new Parameters();
       
        // Retrieve all of the relevant line items
        lineItems = [SELECT Id, Name, Number_of_item__c, Amount__c, Code__c, Payee__c, Contact__c, Job_Number__c, Office__c, Date_of_Expense__c FROM Expense_Line_Item__c WHERE Expense__c = :expense.Id ];
       
        System.debug('ExpensePDFController: Generating Expense for '+expense);
       
    }

}

Test Class:

@isTest
public class  ExpensePDFController_Test{
public static List<String> ADDL_FIELDS = new List<String> {
        'Name',
        'Amount__c',
        'Approved_Date__c',
        'Approved_by__c',
        'Count_Line_Items__c',
        'Date__c',
        'Date_Submitted__c',
        'Status__c',
        'Total_Amount__c'
     };
   
    private static void test_init() {
   
       
        String fields = ADCUtil_Base.strJoin(',', ADDL_FIELDS, 'a01Q0000004Jrk8IAC');
        Expense__c r = (Expense__c) Database.query('SELECT '+fields+' FROM Expense__c ORDER BY LastModifiedDate DESC LIMIT 1');
       
        PageReference ref = Page.ExpensePDF;
        Test.setCurrentPage(ref);
        Apexpages.StandardController std = new Apexpages.StandardController(r);
       
        Test.startTest();
        ExpensePDFController controller = new ExpensePDFController(std);
       
        ref = Page.ExpensePDF;
        //ref.getParameters().put('dlh', '1');
        Test.setCurrentPage(ref);
        controller = new ExpensePDFController(std);
       
        Test.stopTest();
       
    }

}