Find your content:

Search form

You are here

no viable alternative at character ' ' What does this mean?

 
Share

There is a method in a class which i am trying to call from developer console. Here is the definition of the class

public static void ruleEngine(String rule, Date eventdate, String area, Boolean myPortal, String EventType, String EventId)

And here is how i am calling it on Developer console

aclass.ruleEngine('Event Consultant', 2012-11-17 00:00:00 , 'St. Louis' , false, 'Wi-Fi', 'a0mC0000000bEJf');

and the error message i get is

line 1, column 79: line 1:79 no viable alternative at character ' '

is it the way i am passing the date?


Attribution to: Prady

Possible Suggestion/Solution #1

I think it's the way of passing the date. You could remove the time (since it's not a datetime) and try that. Or to be really save use a variable:

Date MyDate = date.newinstance(2012,11,17); 

and then pass that into your method


Attribution to: Salesforce Wizard

Possible Suggestion/Solution #2

Yes its the way you are passing the date.

You can use this

Date eventdate=date.valueOf('2012-11-17 00:00:00');

Returns a Date that contains the value of the specified String. The String should use the standard date format “yyyy-MM-dd HH:mm:ss” in the local time zone


Attribution to: Mohith Shrivastava
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/3865

My Block Status

My Block Content