0

Could you please advise and give me an example of a validation rule to help me make a custom field required when a picklist value is selected.

I have a picklist called Type and a custom field called Description.

The Description field should become required only if the picklist value “Other” is selected.

Could you please advise and give me an example of how such restriction can be achieved?

1

While it's not possible to control field visibility on a standard page layout. You can have a validation rule (VR) to display a message, notifying them that the value is required:

OR( AND( ISPICKVAL(Type__c, 'Other'), ISBLANK(Description__c) ), AND( NOT(ISPICKVAL(Type__c, 'Other')), NOT(ISBLANK(Description__c)) ) )

And have a message like "Description is required when (and ONLY) Type is 'Other'", or you can split this formula into 2 separate VRs (using just AND from each condition) if you want to have a custom notification for each case - e.g. asking users to erase Description value if Type is not Other

0

Create a validation rule something like

AND((!ISPICKVAL(Type,'Other')) , !Null(Description))

This validation rule will thrown the error if the field (Type != other) and (descrption is != null).

  • I received an Error: Syntax error. Missing ')' – Dylan D Jun 17 '16 at 11:44
0

Fields highlight on Condition can not be achievable through standard functions. You have to wright VF pages. Action region and action support function and rendered.

0

Validation is used to validate the data. you can not restrict the field data to show/hide on page using validation rule.

0
  1. On Standard UI conditional visibility of fields is not possible. For this you can do changes on trigger and throw an error message when type is not Other selected and there is value in description field.
  2. Create a VF page and control the rendering of input field using rerender attribute.

Hope it helps you :)

0

There are 2 ways to achieve this.

1.If you have to set up a validation rule like.

AND( ISPICKVAL(picklist_field, text_literal) ,ISBLANK(Custom field))

Like

AND(ISPICKVAL(stagename,"Closed Lost"),ISBLANK(Additional_Comments_reasonlost__c))

It's out of box functionality.

2.If you need to highlight the custom filed only in a specific criteria.You have to go for visualforce pages.Like above Russel baker 1 said.You have to create a visualforce page and can include with in a layout.@Dylan D

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.