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
kevin.chileskevin.chiles 

Entity is not org-accessible at line 1 column 1

Hello!

 

I am having an error when I try to save my code.  This is stating that the object I am referencing is not accessible.  If anyone has any Ideas please let me know!  this has me stumped!

 

trigger AutoCreateCommissionableUser on pymt__PaymentX__c (after insert) {
List<Commissionable_User__c> CU = new List<Commissionable_User__c>();

for (pymt__PaymentX__c newPayment: Trigger.New) {

if (pymt__PaymentX__c.pymt__Contact__c <> null) {

CU.add(new Commissionable_User__c(

RecordTypeId = [select Id from RecordType where Name = 'Payment' and SobjectType = 'Commissionable_User__c'].Id,

Payment__c =Payment.Id,
Commissionable_User__c =pymt__PaymentX__c.Owner.Id ,
Owner=pymt__PaymentX__c.Owner.Id

));

}

}

insert CU;

}

Best Answer chosen by Admin (Salesforce Developers) 
kevin.chileskevin.chiles

Issue resolved!  My call was not correct for my syntax

 

trigger AutoCreateRecurringCommissionableUser on pymt__Payment_Profile__c (after insert) {
List<Commissionable_User__c> CU = new List<Commissionable_User__c>();

for (pymt__Payment_Profile__c newRecPayment: Trigger.New) {

if (pymt__Payment_Profile__c.pymt__Contact__c <> null) {

CU.add(new Commissionable_User__c(

RecordTypeId = [select Id from RecordType where Name = 'Recurring Payment' and SobjectType = 'Commissionable_User__c'].Id,

Recurring_Payment__c =newRecPayment.Id,
Commissionable_User__c = newRecPayment.CreatedById

));

}

}

insert CU;

}

All Answers

JonathanBaltzJonathanBaltz

Kevin,

In your for loop, you assign newPayment to the trigger value, but nowhere in the following code do you use newPayment.  Perhaps:

trigger AutoCreateCommissionableUser on pymt__PaymentX__c (after insert) {

List<Commissionable_User__c> CU = new List<Commissionable_User__c>();

for (pymt__PaymentX__c newPayment: Trigger.New) {
	if (newPayment.pymt__Contact__c <> null) {
		CU.add(new Commissionable_User__c(
			RecordTypeId = [select Id from RecordType where Name = 'Payment' and SobjectType = 'Commissionable_User__c'].Id,
			Payment__c =Payment.Id,
			Commissionable_User__c =newPayment.Owner.Id ,
			Owner=newPayment.Owner.Id));
	}
}

insert CU;

}

 

kevin.chileskevin.chiles

Issue resolved!  My call was not correct for my syntax

 

trigger AutoCreateRecurringCommissionableUser on pymt__Payment_Profile__c (after insert) {
List<Commissionable_User__c> CU = new List<Commissionable_User__c>();

for (pymt__Payment_Profile__c newRecPayment: Trigger.New) {

if (pymt__Payment_Profile__c.pymt__Contact__c <> null) {

CU.add(new Commissionable_User__c(

RecordTypeId = [select Id from RecordType where Name = 'Recurring Payment' and SobjectType = 'Commissionable_User__c'].Id,

Recurring_Payment__c =newRecPayment.Id,
Commissionable_User__c = newRecPayment.CreatedById

));

}

}

insert CU;

}

This was selected as the best answer