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
SAHG-SFDCSAHG-SFDC 

Alert/Error Message to users when the record owner is different

I am working on a requirment where I have a custom button, which calls the visualforce page , which calls the flow

I want only the users who own the record to be able to click on the custom button, others should get an alert

I need suggestions where should this alert be? (The technical behavior is correct, its not letting user use the button ,however, giving weird error -Unhandled flow exception) I  want to give a friendly message here

Any suggestions?
Akash_CRMAkash_CRM
Hi!

You could use JavaScript on the Click event of the custom button, below is the appropriate documentation:

https://developer.salesforce.com/docs/atlas.en-us.workbook.meta/workbook/button_1.htm

In the Javascript code check if the record owner is different then display a Javascript alert message else redirect to the Visualforce page.

Regards,
Akashj.