1

I am getting warning while making existing pick list field as required.

Making this field required may break existing API or Apex requests that do not supply a value for this field

Can anyone help why i am getting this warning?

  • 2
    If you make the picklist required on a page layout (instead of on the field definition), you won't get that warning. And if the page layout is the only place that you want that field to be required (instead of also through api calls and apex/visualforce/lightning), that's probably the way to do it. – martin Jan 24 '17 at 6:07
  • Thanks Martin. But i have different record types (sharing same page layout ) for which this field is not editable. So if i make this field required on page layout then for those record types it will show error even its not editable. So any other alternate solution for this? – Sofiya Jan 24 '17 at 6:16
  • I feel like I'm not seeing the whole picture here, but it sounds like you might need to set up different page layouts for the different record types. – martin Jan 24 '17 at 6:28
  • How about validation rule for specific record type? is this again impact on apex class or test class? – Sofiya Jan 24 '17 at 6:35
  • If you decide to use a validation rule to make a field required, 1. It will not show a red bar next to the field, and will instead show an error message after hitting save (not as user friendly). 2. It will impact apex and test classes, but that's not necessarily a bad thing. If the field needs to be populated under certain circumstances, than that's the way it needs to be however the record is manipulated. – martin Jan 24 '17 at 6:40
0

If you make the picklist required on a page layout (instead of on the field definition), you won't get that warning. And if the page layout is the only place that you want that field to be required (instead of also through api calls and apex/visualforce/lightning), that's probably the way to do it.

If you decide to use a validation rule to make a field required,

  1. It will not show a red bar next to the field, and will instead show an error message after hitting save (not as user friendly).

  2. It will impact apex and test classes, but that's not necessarily a bad thing. If the field needs to be populated under certain circumstances, than that's the way it needs to be however the record is manipulated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.