You need to sign in to do that
Don't have an account?
Jim Montgomery
list has no rows for assignment task trigger
I am trying to add a field from the account when creating a task on an opportunity or account, or contact. I should be able to access the AccountId field on the task record to pull this,.
trigger AccountRecordType on Task (before insert, before update) {
for (Task T : trigger.New){
Account a = [select id,recordtypeid from Account where id =: trigger.new[0].AccountId];
if(a.recordtypeid == '012i0000000Ou0CAAS'){
t.Account_record_Type__c = 'Customer Account';
}
if(a.recordtypeid == '012i0000000Ou0EAAS'){
t.Account_record_Type__c = 'Prospect Account';
}
if(a.recordtypeid == '012i0000000Ou0DAAS'){
t.Account_record_Type__c = 'Partner Account Account';
}
}
}
trigger AccountRecordType on Task (before insert, before update) {
for (Task T : trigger.New){
Account a = [select id,recordtypeid from Account where id =: trigger.new[0].AccountId];
if(a.recordtypeid == '012i0000000Ou0CAAS'){
t.Account_record_Type__c = 'Customer Account';
}
if(a.recordtypeid == '012i0000000Ou0EAAS'){
t.Account_record_Type__c = 'Prospect Account';
}
if(a.recordtypeid == '012i0000000Ou0DAAS'){
t.Account_record_Type__c = 'Partner Account Account';
}
}
}
Best Answer chosen by Jim Montgomery
Raj Vakati