• charforce
  • NEWBIE
  • 60 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 15
    Replies
Hello

I'm hoping someone can help me write a Test Class for this Trigger please?  I have attempted it (first time!) but am having issues with the "insert" line/element (note, the ID's are false ID's for this example):

Test Class:

@isTest 
public class ChildAccountOwnerUpdate {
        static testMethod void ParentChildOwner()   {
        
        Account a = new Account();
        a.Name ='Test Account' ;
        a.ParentId = '0018E00000glxyz';
        a.OwnerId = '005D0000007dxyz';    
        insert ;
       
            }

}

Trigger:

Trigger ParentChildOwner on Account (Before Insert, Before Update, After UnDelete) {
02     
03    List<Account> comingAccounts      = New List<Account>();
04    List<Id> comingAccountsParentIds  = New List<Id>();
05     
06    If(Trigger.IsInsert || Trigger.IsUpdate || Trigger.IsUnDelete){
07        For(Account act : Trigger.New)
08        {
09            If(act.ParentId != NULL)
10            {
11               comingAccounts.add(act);
12               comingAccountsParentIds.add(act.ParentId);
13            }
14             
15        }
16    }
17     
18    List<Account> fetchingParentAccount = [Select Id, OwnerID FROM Account WHERE Id=:comingAccountsParentIds AND OwnerID != NULL];
19    //system.debug('The size of fetchingParentAccount is: ' + fetchingParentAccount.size());
20     
21    For(Account EveryAct : comingAccounts)
22    {
23        //system.debug('EveryAct existing owner id is: ' + EveryAct.OwnerId);
24         
25        For(Account EveryParent : fetchingParentAccount)
26        {
27            If(EveryAct.ParentId == EveryParent.Id)
28            {
29                EveryAct.OwnerId = EveryParent.OwnerId;
30            }
31        }
32         
33        //system.debug('EveryAct new owner id is: ' + EveryAct.OwnerId);
34    }
35}
Hi Experts!

Im trying to complete one of the trailhead tasks, but it keeps erroring out with the following error message. AnimalsHttpCalloutMock: Invalid interface: HttpCalloutMock​. Am I doing something wrong?
@isTest
global class AnimalsHttpCalloutMock implements HttpCalloutMock {
    // Implement this interface method
    global HTTPResponse respond(HTTPRequest request) {
        // Create a fake response
        HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animals": ["majestic badger", "fluffy bunny", "scary bear", "chicken", "mighty moose"]}');
        response.setStatusCode(200);
        return response; 
    }
}
Appreciate the help!
 
I got the requirement for integration(Salesforce Org Integration with Third party app).What all things I need to lookafter for the Integration.
Hello

I'm hoping someone can help me write a Test Class for this Trigger please?  I have attempted it (first time!) but am having issues with the "insert" line/element (note, the ID's are false ID's for this example):

Test Class:

@isTest 
public class ChildAccountOwnerUpdate {
        static testMethod void ParentChildOwner()   {
        
        Account a = new Account();
        a.Name ='Test Account' ;
        a.ParentId = '0018E00000glxyz';
        a.OwnerId = '005D0000007dxyz';    
        insert ;
       
            }

}

Trigger:

Trigger ParentChildOwner on Account (Before Insert, Before Update, After UnDelete) {
02     
03    List<Account> comingAccounts      = New List<Account>();
04    List<Id> comingAccountsParentIds  = New List<Id>();
05     
06    If(Trigger.IsInsert || Trigger.IsUpdate || Trigger.IsUnDelete){
07        For(Account act : Trigger.New)
08        {
09            If(act.ParentId != NULL)
10            {
11               comingAccounts.add(act);
12               comingAccountsParentIds.add(act.ParentId);
13            }
14             
15        }
16    }
17     
18    List<Account> fetchingParentAccount = [Select Id, OwnerID FROM Account WHERE Id=:comingAccountsParentIds AND OwnerID != NULL];
19    //system.debug('The size of fetchingParentAccount is: ' + fetchingParentAccount.size());
20     
21    For(Account EveryAct : comingAccounts)
22    {
23        //system.debug('EveryAct existing owner id is: ' + EveryAct.OwnerId);
24         
25        For(Account EveryParent : fetchingParentAccount)
26        {
27            If(EveryAct.ParentId == EveryParent.Id)
28            {
29                EveryAct.OwnerId = EveryParent.OwnerId;
30            }
31        }
32         
33        //system.debug('EveryAct new owner id is: ' + EveryAct.OwnerId);
34    }
35}
Hi everyone,

I have implemeted extension for my managed class, how to write test class for that.

Thanks in advance.
Manoj
Hi!
I'm trying to establish an HTTPS connection to the customer's endpoint via APEX (using REST)
Until 11 February I had no problems and I called the service correctly, on 12 February the certificate expired. After a couple of days the certificate has been updated by the customer but I get this exception:

System.CalloutException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

The certificate is signed by the CA: Thawte RSA CA 2018

I don't know how to manage it..
Hello,

We are trying to create a connection to Salesforce from our APP.  We have a developer account and get the message "API is not enabled for this Organization or Partner' when we try connect.  Tried changing permissions but it still doesnt work.  Full message in response is below.  Any help will be much appreciated!  Cheers, Mark

 <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>sf:API_DISABLED_FOR_ORG</faultcode><faultstring>API_DISABLED_FOR_ORG: API is not enabled for this Organization or Partner</faultstring><detail><sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault"><sf:exceptionCode>API_DISABLED_FOR_ORG</sf:exceptionCode><sf:exceptionMessage>API is not enabled for this Organization or Partner</sf:exceptionMessage></sf:UnexpectedErrorFault></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
 
Sudden Full Sandbox horrible performance, it takes up to 5 minutes to move from object to object.
Cleared cache and tried different browser and different computer. If I "refresh" the sandbox, will I loose all the work I've done? 
Is there anything else I can try?

i want display inside vf page with bifurcate each API

Like Soap : 20 Used  , 10 Remains

Hi,
Am trying to create sia@jedeye-tech.com as Salesforce user id but SF throwing error as user name already exists am currently using SF Developer Org for practice, this is a task to fininsh TrailHead batch. I have cross checked all the users that i have created but there is no user as sia@jedeye-tech.com but it still am getting the same error
Hi Experts!

Im trying to complete one of the trailhead tasks, but it keeps erroring out with the following error message. AnimalsHttpCalloutMock: Invalid interface: HttpCalloutMock​. Am I doing something wrong?
@isTest
global class AnimalsHttpCalloutMock implements HttpCalloutMock {
    // Implement this interface method
    global HTTPResponse respond(HTTPRequest request) {
        // Create a fake response
        HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animals": ["majestic badger", "fluffy bunny", "scary bear", "chicken", "mighty moose"]}');
        response.setStatusCode(200);
        return response; 
    }
}
Appreciate the help!
 
Hi SalesForce,

I am following up on a case (#12852410) that was initiating at the beginning of this month (Dec 2).  We hit our API limit 2 days in a row and were trying to understand the reason why, as this was causing problems for our team.  Namely, two of the tools we use (and that integrate with SalesForce) were experiencing intermittent failures.  I reached out to the providers of these products (Ebsta and SalesLoft) to see if they knew what was causing the failures and neither really accepted blame for the high number of API calls.  We've hit the limit a couple other times since Dec 2.

I spoke with a SalesForce Tech Support representative last Friday (Andrew Mandalejo) and he recommended that I post on this discussion board and wait for a developer to reach out to me, as he was unable to provide details about where exactly our API calls were coming from and what was causing the limit to be exceeded.  He did say, though, that more often than not these failures are caused by 3rd party tools.  Aside from SalesLoft and Ebsta, I believe the only 3rd party tool we use is Data Loader.

I would like a developer to look at our account and tell me what tool is causing the limit to be reached and recommend a course of action to prevent these failures in the future.  Second, I would like a developer to share pricing information about potentially increasing our API limit.

Thanks,
Max

pagereference parentpage=new pagereference('/'+id);
i tried like above and below
 
return new ApexPages.StandardController(oldtisdetails).view();

both are not working please help me..
HI Dears,

By using soql we can retrieve the records 50k, my requirement is i have 60k records how to i can achive this .


REgards,
viswa.
Maximum view state size limit (135KB) exceededHow can I avoid this error? I read similar post without getting any working solutions for me. When I try to upload file larger than about 900KB, I get the error. Please guide me .
Hi,
I want to learn sales force and want to enter in IT field. My friend told me that there are two modules in sales force viz. Functional and Technical.
Can any one guide me how to learn and get master in this.
Plz help me.

Manoj
I am writing a test class and I am getting this error: System.TypeException: Methods defined as TestMethod do not support Web service callouts
Here is my Test class
@isTest
public class Test_CSS_SOAPEDS {
 
 @isTest static void testEchoString() {              
        // This causes a fake response to be generated
       
        String title = 'Customer Name:CSS EDS WS Test ';
        String workorder = 'workorder1';
        String model = 'null'; //"ISC CM2150"; //"ISB CM850";
        String serialNumber = '46826048';
        String locale = 'en';
        string userGroup=System.Label.UserGroup;
        string userName=System.Label.UserName;
        string encryptedKey = CSS_SOAPEDS.getgenerateToken(userName,userGroup);
        string systemDate;
        string token=userName+';'+userGroup+';datetime-'+systemDate;
        System.debug('The encryptedKey '+encryptedKey);
        System.debug('The title id '+title);
        string session = CSS_SOAPEDS.login(encryptedKey,locale);
        // Call the method that invokes a callout
         Test.setMock(WebServiceMock.class, new EDSwebcalloutMockImpl());
        String output = CSS_SOAPEDS.createDS(session,title,serialNumber,model,workorder);
        System.debug('The output '+output);
        // Verify that a fake result is returned
        System.assertEquals('DSBDT3829', output);
    }
}

Below is my web service mock class

@isTest
global class EDSwebcalloutMockImpl implements WebServiceMock{
    global void doInvoke(
        Object stub,
        Object request,
        Map<String, Object> response,
        String endpoint,
        String soapAction,
        String requestName,
        String responseNS,
        String responseName,
        String responseType) {
            wwwKaidaraCom.createDiagnosticSessionResponse response_elem = new  wwwKaidaraCom.createDiagnosticSessionResponse();
            wwwKaidaraComKaidaraservice.resultDiagnosticSession dsID = new wwwKaidaraComKaidaraservice.resultDiagnosticSession();
            dsID.ID='DSBDT3829';
            system.debug('DSBDT3829<><>' + dsID.ID);
            response_elem.return_x = dsID;
            response.put('response_x', response_elem);

        }
}

Can anyone help me with this?
Thank You
Varun Sinha