0

I have a formula field that has a few conditionals with a hyperlink as a potential outcome.

I want to put a validation rule on the formula field that doesn't allow the user to click the hyperlink field if certain fields are not filled in yet.

Is this possible?

The hyperlink leads to a managed package VFP so I can not put in any custom validation rules there, I also can't put a validation rule directly on the field, so I have to write a generic validation rule for the entire object. But as far as I can see there is no way to have a validation rule on an entire object and target the one field's onPress.

Any suggestions or workarounds?

2

A validation rule won't get you there, as they're only used to prevent record saves on certain conditions. Since you're simply viewing the record, a VR wouldn't help. You should be able to add another formula field that references the original validation rule with your additional checks in place:

IF(SomeCondition, originalHyperlinkField__c, null)

It's generally possible to edit page layouts of custom objects in managed packages, so this would be the most direct route.

3
  • good suggestions. I just realized that the formula fields are also a part of the managed package so I can't edit these either. I think the only work around at this point might be a trigger based off of the managed package class but this feels very hacky...I wish there was a listener for formula fields. – Olivia Jun 4 '20 at 21:18
  • @Olivia You can add a formula to the object, so it's not so much editing the existing formula, but creating a new one that references the original. – sfdcfox Jun 4 '20 at 21:25
  • I see what you are saying. I do need to target the onCilck/onPress which I doesn't seem possible with formula fields or validation rules. I think I have to rebuild the formula field in a JS button. But this is slightly separate then what my original question was, so your answer works – Olivia Jun 8 '20 at 16:49

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.