• David K.
  • NEWBIE
  • 0 Points
  • Member since 2015
  • IT dude

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Trying to use salesforce/Lightning connect to access external data in an Oracle Database.

Our challenge is that we have multiple Salesforce accounts that are reference a single external account id.

So in Salesforce there are 2 accounts that both use account "A5"
We can't make the external ID field unique because of this.

If the external id is not unique, it is not available in Lightning connect.

Has anyone had experience with this and a possible workaround?

Thanks,

Dave K.

Hi,

I am writing a test case against my custom controller.  I can get all the components to populate correctly, but the database query inside the function I am trying to test does not seem to be returning any results.  Any suggestions on what I need to change or add?

CONTROLLER function:
NOTE: I tested things and the buildWhereClause works correctly, so I'm not including that code as it is long.  Similarly, the sortOrder has a default value so it doesn't matter either.  The debugging messages show that neither query is returning any values (the record size returned by both is 0).

 public List<Bolete__c> getBoletes()
    {
        buildWhereClause();

        List<Bolete__c> resultsMax = Database.query(
            'SELECT Genus__c, Species__c, Common__c ' +
            'FROM Bolete__c ' +
            whereClause
        );
        //Total number of records
        recordSize = resultsMax.size();
       
        List<Bolete__c> results = Database.query(
            'SELECT id, Genus__c, Species__c, Common__c, imageURL__c, Edibility__c, Tells__c ' +
            'FROM Bolete__c ' +
            whereClause +
            'ORDER BY ' + sortOrder  +
            'LIMIT 20'
        );
        resultSize = results.size();
        System.debug('getBoletes  recordSize:' + recordSize + ' resultsize:' + resultSize);
        return results;
    }

TEST CASE: (NOTE: the Result Size should be 74, but is returning 0, so the assert fails.)
    @istest static void TestShowResultSize()
    {
        Test.startTest();
        PageReference pg = Page.BoleteSearch;
        pg.getParameters().put('boxNum','49');
        Test.setCurrentPage(pg);
        BoleteController ctrl = new BoleteController();
        ctrl.setChkBoxValue();
        List<Bolete__c> bols = ctrl.getBoletes();
        String wc = ctrl.currentWhereClause;
       
        Integer resultsize = ctrl.showResultSize;
        System.assert(resultsize==74, wc);
        Test.stopTest();
    }