function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
madhusudhanmadhusudhan 

Trigger execution problem

i am getting the error on account, what is the problem behind this problem i can't understand please verify and send me the right trigger

 

 

 

 

trigger accountactive on Account (before insert)
{
for(integer i=0;i<trigger.new.size();i++)
{
Account temp=trigger.new[i];
if(temp.phone==null)
{
temp.adderror('must and should enter the phone number(mandetory)');
}
}
}

Chamil MadusankaChamil Madusanka

Post your error

Navatar_DbSupNavatar_DbSup

Hi,

 

You trigger check the phone (field) of account. If the Phone filed is blank when creating a new account “Error: Invalid Data.
Review all error messages below to correct your data.must and should enter the phone number(mandetory)
” error message will be display. Please specify your requirement what you want?

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

 

 

 

Teach_me_howTeach_me_how

maybe try this..

 

trigger accountactive on Account (before insert)
{
for(integer i=0;i<trigger.new.size();i++)
{
if(trigger.new[i].phone==null)
{
temp.adderror('must and should enter the phone number(mandetory)');
}
}
}

Chamil MadusankaChamil Madusanka

Try this

 

trigger accountactive on Account (before insert)
{
for(Account tempAcc : trigger.new)
{

if(tempAcc.phone==null)
{
tempAcc.adderror('must and should enter the phone number');
}
}
}

 If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.