user891859
user891859

Reputation: 293

Salesforce - Newbie to Apex

I could use some general assistance with a simple bit of Apex code. Just so you know I am a newbie to Salesforce.com, but not to web application programming (12 years but with Coldfusion and some Perl and am used to the MVC architecture), although I have not been exposed deeply to Java or C#.

So I am working on a simple controller that I'll use in a simple VF page. I'd just like to return the value and display it on the page but Im running into some syntax issues during compile. Here's my code so far:

Controller - mytest.cls

    public with sharing class myTest {

    public class addNewFolder {

        String tmpFolderName = 'MyTestFolder';
        String tmpObjectID = '22K22'; 

        String tmpResult = 'Whoo-hoo!';
        System.debug('XIX|' + tmpResult);
        return tmpResult;

    }

}

Error

Description Resource Path Location Type Save error: expecting a right parentheses, found 'XIX|' mytest.cls /PREPROD/src/classes line 15 Force.com save problem

Upvotes: 1

Views: 684

Answers (2)

Andrii Muzychuk
Andrii Muzychuk

Reputation: 1188

As I understand

addNewFolder

is a METHOD. So instead of writing

public class addNewFolder

you must write public string addNewFolder() {... return tmpResult;}

I hope it will help you.

Upvotes: 1

Matt K
Matt K

Reputation: 7337

It looks like the | character is causing the error. You could try escaping the | character like this:

System.debug('XIX\\|' + tmpResult);

Or, you could use a different character:

System.debug('XIX-' + tmpResult);

Update: Upon looking more carefully at your code, I realized superfell is right (see his comment on your question above).

Upvotes: 0

Related Questions