I have the following code.

Account a = new Account(Name='Doria Account'); insert a;

It returns me an error because the field "Industry" is required. What is weird is the fact that in the Page Layout the field is not highlighted in red (as happens for the required fields). I knew that if a field is set universally required it should affect also all the page layouts containing that field. Am I wrong?

1 Answer 1


You are right. If any field is made mandatory at object level universally, it should be mandatory in all page layouts. Please check if your error is coming through validation rule.

  • 1
    Additionally if the field is made universally required I believe you would see a message under the field that says "Error: You must enter a value" and not The field "Industry" is required.
    – Rao
    May 6, 2015 at 17:51
  • You are perfectly right. I found the following trigger I had written (and then forgotten) time ago: trigger stopNoIndustry on Account (before insert){ for (Account acc : trigger.new) { if(acc.Industry == null){ //acc.addError('Industry field required!!'); acc.Industry.addError('Industry required'); } } } May 6, 2015 at 17:53
  • @AndreaIanni௫ please mark the answer solved for the sake of others who come to this site looking for answers, when you get some time :)
    – Rao
    May 6, 2015 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .