I have a validation rule on the Account Object as below:
AND(
NOT ISBLANK( Name),
ISPICKVAL (Account_Level__c, "Company" ),
ISBLANK( Address__c ),
NOT $User.Status__c
)
The above rule working when the Account is Created/Updated.Now I have created a Trigger on the Custom Object(Company):Trigger name is CompanySurvey. In CompanySurvey Trigger I Update the one field in Account Object.At the time does't showing the ERROR in standard-lone.But Account is not Updated because is validation rule executes.I have debug the CompanySurvey Trigger in ERROR logs it show the error message but not showing the standard-lone.Some body please help me.
Company lookup with Account Object.
Trigger Code:
Trigger SurveySurvery on Company__c (AFTER INSERT)
{
TRY
{
FOR(Company__c sur : TRIGGER.NEW)
{
Account acc = NEW Account();
acc.Id = sur.Account_Name__c;
acc.Last_Survey__c = Date.valueOf(sur.CreatedDate);
UPDATE acc;
}
}
CATCH(EXCEPTION E)
{
SYSTEM.DEBUG('MAIN ERROR : COMPANYSURVEY'+E);
}
}