I have a additional_Contacts fields on case object if this is null and user trying to save the record apex trigger should show error message.after showing the error message user stil want to save the record and the record should be saved with case owner name. Additional_Contacts is look up to User . We should not write any VF page or Class for this scenario.


You cannot do that without creating a custom VF page. You can do one of the following.

  1. Create a checkbox with label like "Submit without Additional Contacts". Then you can validation rule or trigger to check if the lookup is blank and the user has not selected the checkbox as well, then display a message that either populate the lookup or select the checkbox to confirm that the record should be submitted without the additional contacts.
  2. Alternatively, you can do is create a formula field that displays a message like "You have not added Additional Contacts. Please ensure this field is populated if required". The formula can check if the lookup field was blank and display the message. If you want to display the message in big bold colorful letters, then you can create an image and store it in Static Resources and display it using the formula field.

IF ( ISBLANK(My_Field__c)) , IMAGE('https://*******.salesforce.com/resource/1402329947000/MyMessage', 'warning message'),'')

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.