You need to sign in to do that
Don't have an account?
its chantee
Trigger Concepts
Hi to all
senario : When Ever a record is creted in Student object , get the details in payment object also
student is parrent record && Payment is Child
Fields in Student
Student Name
Batch ( Lookup relation in Traing Object )
Fee
when u inserting the records student name , batch & Fee these fielda are display the payment object that aree student name & Fee
trigger studentregis on Student__c(After insert)
{
Student__c stu = trigger.New[0];
Payment__C pay = New Payment__C (StudentName__c=pay.Name_c,
StudentID = pay.ID,
Batch__C =pay.Batch__c,
Fee__C =pay.Fee__C);
insert stu;
}
Getting an error line 1 Column 1
senario : When Ever a record is creted in Student object , get the details in payment object also
student is parrent record && Payment is Child
Fields in Student
Student Name
Batch ( Lookup relation in Traing Object )
Fee
when u inserting the records student name , batch & Fee these fielda are display the payment object that aree student name & Fee
trigger studentregis on Student__c(After insert)
{
Student__c stu = trigger.New[0];
Payment__C pay = New Payment__C (StudentName__c=pay.Name_c,
StudentID = pay.ID,
Batch__C =pay.Batch__c,
Fee__C =pay.Fee__C);
insert stu;
}
Getting an error line 1 Column 1
Write the below trigger on Student Object.
You have wrongly assigned.
Payment__C pay = New Payment__C (pay.Name_c = StudentName__c,
pay.ID = StudentID, pay.Batch__c = Batch__C,pay.Fee__C = Fee__C );
Hope it will work. Assignment should be always from Right to left.
Stiil I am Getting an error
Entity is not org-accessible at line 1 column 1
Are you using the right API Name of Student__c?
Check in the object.
The error is due to API name mismatch.In your code,
trigger studentregis on Student__c(After insert)
{
Student__c stu = trigger.New[0];
Payment__C pay = New Payment__C (StudentName__c=pay.Name_c,
StudentID = pay.ID,
Batch__C =pay.Batch__c,
Fee__C =pay.Fee__C);
insert stu;
}
pay.Name__c should come instead of pay.Name_c,. If that not so,check all your field name with corresponding API Name.