0

I have an apex class that was scheduled and working fine. Due to inactive user the scheduled job has stopped working and now I am trying to create a new schedule for the apex class but getting below error.

"You must select an apex class that has a parameterless constructor"

As per my understanding we dont need to create a parameterless constructor specifically. Also as it was working before it should work now as well.

Tried compiling all classes but no luck.

Need you expertise to solve this issue. Thanks a lot in advance.

1 Answer 1

2

Apex classes have a default, no-argument constructor, but as soon as you declare any other constructor you lose it.

If your apex class has any constructor, then you need to explicitly create the no-arg constructor yourself.

e.g.

public class MyClass{ Integer memberInt; public MyClass(Integer oneArg){ memberInt = oneArg; } // Since this class has at least one constructor defined, we lose the // automatic no-arg constructor. // If you need a no-arg constructor, you need to write it yourself public MyClass(){ } } 
1
  • Thanks for the help. So my concern is how this class was scheduled before and working correctly till now. Commented Apr 20, 2022 at 12:15

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.