1

I am new to this community and using eclipse but have gotten the basics down. I am trying to create a button on our lead page to go the next record in the list and have found this post stating how:https://developer.salesforce.com/page/The_Get_Next_Button.

I am now having issues trying to deploy the Apex Code in Eclipse, if I paste all the apex code into a new class and try to run it I get an error saying 'Test methods must be in test class' which I understand(I also tried putting @istest where the tests began and got the same thing if it matters).

So the next thing I tried was to cut all the tests which start at line 83 down to the bottom and also making sure to fix up the }. Put this into a new apex class called 'TestRetrieveNextUtils' and want to deploy this before the actual class, this is when I ran into more errors.

The first error I got was 'unexpected token: Group', I then called one of my friends who knew some code and had used eclipse before. I was told to put in 'public class TestRetrieveNextUtils {' before everything in the test which worked but new error.

The next error is what caused a lot of confusion for my friend as he isn't familiar with Force.com. The next error was: "Method does not exist or incorrect signature:retrieveNextLead(Id)'. This seems to be that its calling on the method that is in the actual class and not in the test itself but we couldn't keep them in the same class because of the first error we got. He and I couldn't understand why Salesforce have written this code all in one section when you can't actually deploy the code in such a manner in eclipse. If anyone could help or shed some light that would be great thanks. I have attached some pictures of errors and pastebins of the class all as one and just the test.

These are the pastebin files but I cant post more than 2 links which ive used for errors.

/pMLd1Vm4

/4kWGNRHb

TestRetrieveNextUtils RetrieveNextUtils

2
1
  1. You need to create the Test in a separate class to the actual code.
  2. You need to deploy the test class and the code class at the same time. This can be done in eclipse (https://developer.salesforce.com/page/Deploy_Force.com_Applications_Faster), you just need to select the multiple items within the same deploy.

Assuming you are using a sandbox and a production org, I would personally prefer to use change-sets to deploy as it is considered better practice and once you have setup the change-set you can redeploy easily. See here for info on change-sets: https://help.salesforce.com/HTViewHelpDoc?id=changesets_about_outbound.htm&language=en_US

2
  • Doesn't work I'm afraid, I still get the same error saying Method does not exist as above.
    – Michael
    Nov 4 '14 at 2:42
  • Is it that the method signature is: retrieveNextLead(String) but you are calling retrieveNextLead(Id) from the test... retrieveNextLead(Id) does not exist, try converting the Id to a String e.g String uId = u.Id; retrieveNextLead(uId);
    – dacology
    Nov 4 '14 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.