function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kathryn LiKathryn Li 

cannot create apex class

Hi there.

I just got touch with Salestouch since last week.

I have created two custom objects calles purchase record and purchase item. Purchase Reocrd is the parent in the master detail relationship with purchase item, and contact is the parent of purchase record.

The thing I want to do is to create a custom field in contact, so that I can calculate the total purchase amount in past 6 months for each contact.

The roll up field let me to sum up, but it only can calculate on specific date, not dynamic/relative date.

The formula field cannot sum, but can use TODAY() function.

When I asked others for suggestion, I was told that I can use Apex to doing this.

However, in the developer console, when I click File>>new, the Apex class and trigger is turned to grey, so I cannot create a new one.

I searched on the internet and someone said that is because of the production org. So I create a new sandbox, but still cannot create a new apex class.

There is another reason, which is about permission. They said the Author Apex field have to be enabled. However, I cannot find this field and I enable a field called Apex REST Services in the permission set. But this one can only be enable in the profile created by me.

I have stuck in this problem for whole day. Could anyone help?

One more additional information, I am using the developer account with free trial. I don't know whether this is the reason.

Best Answer chosen by Kathryn Li
SandhyaSandhya (Salesforce Developers) 
Hi,

You might be using Professional edition trail org.Did you sign up from below link for developer edition.

https://developer.salesforce.com/signup
 
I would suggest you sign up from above link and then try to create new apex class, you will be able to create.

Please mark it as solved if my reply was helpful, it will make it available
for others as a proper solution.

Best Regards,
​Sandhya
 




 

All Answers

SandhyaSandhya (Salesforce Developers) 
Hi,

You might be using Professional edition trail org.Did you sign up from below link for developer edition.

https://developer.salesforce.com/signup
 
I would suggest you sign up from above link and then try to create new apex class, you will be able to create.

Please mark it as solved if my reply was helpful, it will make it available
for others as a proper solution.

Best Regards,
​Sandhya
 




 
This was selected as the best answer
Kathryn LiKathryn Li

Thanks Sandhya.

I register for a developer account through that page at the beginning.

And after I login to the developer.salesforce.com, under my name, I can see My Developer Account, that should links to my developer org.

Kathryn LiKathryn Li

Sandhya, you're right, mine is not the developer edition.

For those who are having the same issue, you can goto setup>>company information to chack which edition you are in.