You need to sign in to do that
Don't have an account?
Briana Kruse 2
First Trigger Help
I have my first trigger written as before insert and need to change it to be before insert, before update but I'm stuck! Any ideas?
trigger TaskCustomActivity on Task (before insert, before update){
if (trigger.isBefore)
{
if(Trigger.isInsert)
{
for(Task.t = trigger.new){
t. custom_activity_type__c = Type;
insert cont;
}
}
else if (Trigger.IsUpdate)
{
Type = '(Update)';
Custom_Activity_Type__c = Trigger.new;
update cont;
}
}
}
Can you please explain what is your actual requirement?. We don't have to write any insert statement in Trigger.isInsert and in same way Update DML in Trigger.isUpdate. It automatically do the same.
Try above code and on line 3 you can chage type value. Please mark this answer as best answer if it solves your issue.
Thanks,
Rashi
First of all you need to define "cont" before inserting or updating it. It look like you are trying to update or insert Contact information based on Task object.
Please provide us the actual requirement to further help you out on this.
Thanks,
Gaurav
trigger TaskCustomActivity on Task (before insert, before update)
{
for(task t:trigger.new)
{
t. custom_activity_type__c = t.Type;
}
}
Thanks.
Try following sample code.
Hope this solves your issue.
Thanks,
Rashi