You need to sign in to do that
Don't have an account?

getting compiler error while running a trigger
Hi getting above error:Compile Error: Expression cannot be assigned at line -1 column -1
I am understanding what is this error and how debug it??
Is there any need od change in code,,Please help me
trigger AttachmentandReferralpoints on Student_Profile__c (before insert, after insert,after update) {
if(trigger.isupdate)
{
list<string> preferredcoursenames=new list<string>();
list<string> preferredtimeslot=new list<string>();
for(student_profile__c studentprofile:trigger.new)
{
preferredcoursenames.add(studentprofile.Prefered_Course__c);
preferredtimeslot.add(studentprofile.Preferred_Course_Start_Date__c);
}
list<string> timeslots=new list<string>();
for(string splitvals:preferredtimeslot)
{
list<string> s=splitvals.split(',');
timeslots.add(s[0]);
}
map<string,id> courseNameIdMap=new map<string,id>();
for(Course_Program__c programs:[select id ,name, Type_of_Program__c,Month__c from
Course_Program__c where Type_of_Program__c in :preferredcoursenames and month__c=:timeslots])
{
courseNameIdMap.put(programs.Type_of_Program__c ,programs.id);
}
list<Course_Program__c> CourseProgram = new list<Course_Program__c>();
for(student_profile__c updatingstudentprofile:trigger.new)
{
///preferredcoursenames.add(studentprofile.Prefered_Course__c);
if(courseNameIdMap.containskey(updatingstudentprofile.Prefered_Course__c))
{
updatingstudentprofile.Course_Program__c=courseNameIdMap.get(updatingstudentprofile.Prefered_Course__c);
}
else
{
Course_Program__c newprogram =new Course_Program__c();
Course_Program__c.name=updatingstudentprofile.Course_Name__c;
Course_Program__c.Type_of_Program__c=updatingstudentprofile.Prefered_Course__c;
Course_Program__c.month__c=updatingstudentprofile.Preferred_Course_Start_Date__c;
CourseProgram.add(newprogram);
}
}
if(!CourseProgram.isempty())
insert CourseProgram ;
}
}
I am understanding what is this error and how debug it??
Is there any need od change in code,,Please help me
trigger AttachmentandReferralpoints on Student_Profile__c (before insert, after insert,after update) {
if(trigger.isupdate)
{
list<string> preferredcoursenames=new list<string>();
list<string> preferredtimeslot=new list<string>();
for(student_profile__c studentprofile:trigger.new)
{
preferredcoursenames.add(studentprofile.Prefered_Course__c);
preferredtimeslot.add(studentprofile.Preferred_Course_Start_Date__c);
}
list<string> timeslots=new list<string>();
for(string splitvals:preferredtimeslot)
{
list<string> s=splitvals.split(',');
timeslots.add(s[0]);
}
map<string,id> courseNameIdMap=new map<string,id>();
for(Course_Program__c programs:[select id ,name, Type_of_Program__c,Month__c from
Course_Program__c where Type_of_Program__c in :preferredcoursenames and month__c=:timeslots])
{
courseNameIdMap.put(programs.Type_of_Program__c ,programs.id);
}
list<Course_Program__c> CourseProgram = new list<Course_Program__c>();
for(student_profile__c updatingstudentprofile:trigger.new)
{
///preferredcoursenames.add(studentprofile.Prefered_Course__c);
if(courseNameIdMap.containskey(updatingstudentprofile.Prefered_Course__c))
{
updatingstudentprofile.Course_Program__c=courseNameIdMap.get(updatingstudentprofile.Prefered_Course__c);
}
else
{
Course_Program__c newprogram =new Course_Program__c();
Course_Program__c.name=updatingstudentprofile.Course_Name__c;
Course_Program__c.Type_of_Program__c=updatingstudentprofile.Prefered_Course__c;
Course_Program__c.month__c=updatingstudentprofile.Preferred_Course_Start_Date__c;
CourseProgram.add(newprogram);
}
}
if(!CourseProgram.isempty())
insert CourseProgram ;
}
}
list<string> preferredcoursenames=new list<string>();
list<string> preferredtimeslot=new list<string>();
to
list<string> preferredcoursenames;
list<string> preferredtimeslot;
and try to compile the trigger..