• DJAISH
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Overnight all of my sandboxes (in all my orgs) have changed their test method procedure. It now goes through the developer console instead of the "Apex Test Execution" page.

This one-page was an extremely handy method to see all information in one place, and easily download the logs. Is there any way of running tests through the old page. 

 

Any other ways of easily getting the logs?

  • January 24, 2013
  • Like
  • 0

I've tried this just about every way I can spin it.

I have an object that creates opportunities based on criteria given, basically it's used for a payment plan situation. On this other object is a lookup to Contact and to Campaign.

I am trying to put Account and Campaign on the created opportunity. Shouldn't be hard. Here's what happens:

I get the information:

system.debug(thisCamp); //gives me the campaign ID I want
Opportunity thisOpp = new Opportunity(
            Name=OppName,
            Campaign=[SELECT Id, Name FROM Campaign WHERE Id=:thisCamp] //returns 1, and the right one when debug was run on it.
        );
Opportunities.add(thisOpp); // add to list to be inserted later
system.debug(thisOpp); //Ignores my Campaign field returns Opportunity:{Name=DefaultNameForTest}

 The above is a very simplified version of the code, since everything else works. The opportunity will get created, all the other fields (aside from account which gives me the same issue) will insert just fine. 

Is this something regarding standard field lookups? It works fine if I create a custom lookup to campaign, but that means I have to rewrite any logic that might be used based on the standard fields elsewhere ... doesn't seem right.

The trigger is run on creation of the parent record (let's call it PaymentPlan). 

 

Thank you

  • August 10, 2012
  • Like
  • 0

I hope I'm missing a fundamental salesforce coding knowledge. 

 

After putting together my code and testClass and deploying (with 100% coverage), I realized it didn't quite do what I wanted it to do, so I tweaked it in sandbox. got it to work and then deployed. went along my way until the client came back and told me that it was still using the old functionality. I looked and saw that the update failed. 

 

I tried

- deactivating the trigger and class

- deactivating each individually

- making whitespace changes

- from eclipse

- from sandbox

 

All of which fail. 

 

The error codes states: The Apex job named "Merge Job" is already scheduled for execution.

 

It points to another trigger that it claims is having the issue. However if the code is validated and deployed, how come I can't make whitespace changes?

 

Thanks anyone that can help.

I'm having some difficulty wrapping my head around the HttpRequest function, was hoping someone could push me along.

 

I'm trying to forward some key information to my web database on every save of a single custom object. My understanding was that using HttpRequest would be similar to sending a form to the page and I would be able to parse the array values there.

 

My difficulty is understanding how to tell the HttpRequest which Object I want it to function off of and more importantly how to identify which fields to send.

 

Given the code in the reference book I commented my confusions:

 

public class AuthCallout {
   public void basicAuthCallout(){
      HttpRequest req = new HttpRequest();
      req.setEndpoint('http://www.yahoo.com'); //OK, So I obviously changed this to my website

      req.setMethod('GET');  //I'd prefer a POST, but GET is fine

      // Specify the required user name and password to access the endpoint
      // As well as the header and header information
      String username = 'myname';  //I don't need this, I plan to use other means of authentication

      String password = 'mypwd';     //I don't need this, I plan to use other means of authentication
      Blob headerValue = Blob.valueOf(username + ':' + password); //don't need this either
      String authorizationHeader = 'BASIC ' +                                   //don't need, right?

      EncodingUtil.base64Encode(headerValue);                               //do I need? I don't know.

      req.setHeader('Authorization', authorizationHeader);               //still don't need

     // Create a new http object to send the request object
      // A response object is generated as a result of the request
      Http http = new Http();            //WHAT is this?

      HTTPResponse res = http.send(req); //I don't need a response
      System.debug(res.getBody());         // I don't need this either

   }
}

 

This leaves my code at a very confusing:

 

public class AuthCallout {
   public void basicAuthCallout(){
      HttpRequest req = new HttpRequest();
      req.setEndpoint('http://www.myurl.com');

      req.setMethod('GET'); 

      Http http = new Http(); /maybe?

  }

}

 

So either I want to make a dynamic URL:

req.setEndpoint('http://www.myurl.com?name=a.name__c&phone=a.phone__c&etc=et_cetera__c');

 

OR

 

somewhere else I need to define my array variables

 

Can someone help me with this? I would be very appreciative.

Hi all,

We had hired a developer to write some apex code for us to which I needed to make minor alterations. I was able to, without a problem, download the code and make the necessary alterations. What I can't figure out is how to replace the original code with my new code. There is probably an incredibly simple answer to this question, but where do I go in salesforce to edit live apex code?

 

  • March 13, 2009
  • Like
  • 0

I hope I'm missing a fundamental salesforce coding knowledge. 

 

After putting together my code and testClass and deploying (with 100% coverage), I realized it didn't quite do what I wanted it to do, so I tweaked it in sandbox. got it to work and then deployed. went along my way until the client came back and told me that it was still using the old functionality. I looked and saw that the update failed. 

 

I tried

- deactivating the trigger and class

- deactivating each individually

- making whitespace changes

- from eclipse

- from sandbox

 

All of which fail. 

 

The error codes states: The Apex job named "Merge Job" is already scheduled for execution.

 

It points to another trigger that it claims is having the issue. However if the code is validated and deployed, how come I can't make whitespace changes?

 

Thanks anyone that can help.