0

How would I go implement validation on a standard salesforce page?

The validation rules are:

I have the following:

1) Attachment - Checkbox (default checked) 
2) URL - Textbox

If the Attachment is uncecked then URL is required If the Attachment is checked then URL should be Readonly/disabled

  • If the Attachment is checked then URL should be Readonly/disabled this is bit confusing.. – Ratan Paul May 9 '16 at 16:05
  • meaning that user can either check the checkbox which is by default and leave it as it is or user can enter the valid URL – Nick Kahn May 9 '16 at 16:08
1

just go to setup> create > object> your object and create new validation rule

if(Attachment == FALSE && URL == null, true, false)

It will give error if attachment is uncheck and URL is null.

for second part I don't think it will be natively possible.But you can use validation rule for same something like if(Attachment == FALSE && URL != null, true, false) then display error meessage please clear URL . This will solve both problem

  • i don't understand >> for second thing make URL dependent field based on attachment check-box. This will solve both problem what do you mean by URL dependent field based? can you elaborate little bit more on that – Nick Kahn May 9 '16 at 15:59
  • okay got it but I don't see the URL__C in Field Dependency, so I have click on new dependency -> Controlling Field is my attachment and Dependent Field -> I do not see the ur__c ? what might be the issue? – Nick Kahn May 9 '16 at 16:13
  • @NickKahn Please check updated answer. – Tushar Sharma May 9 '16 at 16:18
  • Nope did not work, if i add your updated condition if(Attachment == FALSE && URL != null, true, false) then i can save my record with unchecking the attachment and not entering anything in the URL field – Nick Kahn May 9 '16 at 16:20
  • this validations works if(Attachment == FALSE && URL == null, true, false) but only problem with that is, i can have both attachment checked and enter url but in my case i should only be have one or the other meaning either Attachment checked or enter URL but not BOTH – Nick Kahn May 9 '16 at 16:26

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.