• Julien Lussier
  • NEWBIE
  • 0 Points
  • Member since 2015

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

I'm currently writing a test class for a trigger and I'm a bit stumped. My trigger calls a utility class which has a @future(callout=true) method, in which a soap message is written. In this method there is a query in order to get all the information related to the record and the related records. However, this query always ends up returning null during tests (it works fine otherwise). If I comment out the @future(callout=true) then the query has no issue finding the data. Can someone point me to what I might be doing wrong?

Test class:

public static testMethod void oppTest() {
        User u = Test_HelperMethods.createUser('oTF', 'oTL', p.Id);
        insert u;
        system.runAs(u) {
            Account a = Test_HelperMethods.createPolicyAccount();
            insert a;
            Opportunity opp = Test_HelperMethods.createOpportunity();
            opp.AccountId = a.Id;
            insert opp;
            
            Test.startTest();
            opp.StageName = 'Committed';
            update opp; //utils method only gets called in afterupdate.
            Test.stopTest();
}

Methods called:

    @future(callout=true)
    public static void updateStatus(List < Id > oppIds) {
        String oppId = oppIds[0];
        String soapMessage = prepareSOAPMessage(oppId);
        ... //rest of method goes here

    private static String prepareSOAPMessage(Id oppId){
        OCB_Environment__c re = OCB_Environment__c.getValues('Sandbox');
        
        system.debug('OppID ='+oppId); //Id gets passed properly
        List<Opportunity> oppList = [SELECT Id FROM Opportunity WHERE Id =: oppId];
        system.debug('oppList: '+ oppList); //this will return empty.

Thanks
Hi,

I've run into an error with the Flows in one of my orgs. Users were able to go through the flow with no issues, then out of nowhere everyone (including admins) suddenly started getting the following error when trying to start the flow process:

Data Not Available The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page.

I can confirm that the data DOES exist and has not been deleted, and that it can be accessed. There have been no changes made to the org between when it was working and when the error occured. The Flow is still working fine in our test environments.

Any help would be greatly appreciated.
Hi,

I've run into an error with the Flows in one of my orgs. Users were able to go through the flow with no issues, then out of nowhere everyone (including admins) suddenly started getting the following error when trying to start the flow process:

Data Not Available The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page.

I can confirm that the data DOES exist and has not been deleted, and that it can be accessed. There have been no changes made to the org between when it was working and when the error occured. The Flow is still working fine in our test environments.

Any help would be greatly appreciated.