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
SureshSuresh 

Error: Compile Error: Entity is not org-accessible at line 1 column 1

Hi All,

Can any one solve this issue .

trigger defaultpayment on Student__c (after insert) {
    Student__c student = trigger.new();
    Payment__c payment = new Payment(Student__c = student.Name,StudentId=student.Id,Amount = 200);
    
insert payment;
}

Regards,
Suresh.
Best Answer chosen by Suresh
Tejpal KumawatTejpal Kumawat
Hello Suresh,

Try this code :
 
trigger defaultpayment on Student__c (after insert) {
    list<Payment__c> payments = new list<Payment__c>();
	for(Student__c student : trigger.New){
		payments.add(new Payment__c(Student__c = student.Id, StudentId=student.Id, Amount = 200));
	}
	insert payments;
}
If this answers your question mark Best Answer it as solution and then hit Like!
 

All Answers

Sampath KumarSampath Kumar
Hi Suresh,

Please find the code below:

trigger defaultpayment on Student__c (after insert) {
    Student__c student = trigger.new();
    Payment__c payment = new Payment__c(Student__c = student.Name,StudentId=student.Id,Amount = 200);
    
insert payment;
}

Check api names of studentId and Amount and place it correctly where you are creating the payment and __c is missing in Payment__c payment = new payment();

Mark this as best answer if this solves your query.

Regards
Sampath Kumar Goud
Tejpal KumawatTejpal Kumawat
Hello Suresh,

Try this code :
 
trigger defaultpayment on Student__c (after insert) {
    list<Payment__c> payments = new list<Payment__c>();
	for(Student__c student : trigger.New){
		payments.add(new Payment__c(Student__c = student.Id, StudentId=student.Id, Amount = 200));
	}
	insert payments;
}
If this answers your question mark Best Answer it as solution and then hit Like!
 
This was selected as the best answer
AmitSahuAmitSahu
You can check http://getthekt.com/2016/06/16/error-compile-error-entity-is-not-org-accessible/

for similar issue