function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Coral RacingCoral Racing 

Create a Validation to produce a question rather than a data error?

Hello

I am new to Salesforce and Apex Code but having to learn on my feet. 

 I have created the following validation rule:

ISCHANGED( OwnerId ) && NOT(ISNEW() ) && OR((BEGINS(BMCServiceDesk__Client_Last_Name__c ,"1")),(BEGINS(BMCServiceDesk__Client_Last_Name__c ,"2")),(BEGINS(BMCServiceDesk__Client_Last_Name__c ,"3")), (BEGINS(BMCServiceDesk__Client_Last_Name__c , "4"))) &&  BMCServiceDesk__Impact_ID__c  = 'HIGH' &&  BMCServiceDesk__Urgency_ID__c = 'HIGH'

 

However I would like this to only produce a validation question or information reminder (FYI) to the user rather than a data error  so they can continue as they were withouth making data input chnages if not required

Is there an easy way to do this?

Many thanks

Sonya

Best Answer chosen by Coral Racing
Karan Khanna 6Karan Khanna 6
Hi Sonya,

Unfortunately I dont think you would be able to achieve this through Validation rule. Validation rules are meant only to stop the user from creating the records.

But there are couple of other ways to achieve this, I have listed few:

1. Create a VF page instead of Standard page, VF Page gives liberty to send warning messages.
2. Create a text field on that object and populate this warning message in that field through trigger.

All Answers

Ramu_SFDCRamu_SFDC
Validation is a way to restrict user from saving the records. If you want to show a user friendly message without restriction, you would need to create a visualforce page and write a javascript alert function to show the message.
Karan Khanna 6Karan Khanna 6
Hi Sonya,

Unfortunately I dont think you would be able to achieve this through Validation rule. Validation rules are meant only to stop the user from creating the records.

But there are couple of other ways to achieve this, I have listed few:

1. Create a VF page instead of Standard page, VF Page gives liberty to send warning messages.
2. Create a text field on that object and populate this warning message in that field through trigger.
This was selected as the best answer
Coral RacingCoral Racing
Thanks for your replies.  As I mentioned my knowledge is limited so I will have to investiagte how to create a visual force page or create a trigger.

Many thanks
Karan Khanna 6Karan Khanna 6
Hi Sonya - Please mark appropriate answer as Best to close this thread. and feel free to post if you face any issues while writing code.