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
Aidel BruckAidel Bruck 

Custom alert for custom object

I need to a way to have a field on custom objects for an alert that will popup when the record is opened.
What is the best way to go about this?
Best Answer chosen by Aidel Bruck
Shams TabrezShams Tabrez
Hi Aidel,

This process will be achieved using a custom field with datatype as a check box and a visualforce page. Please follow the below reference link.

https://www.salesforcetutorial.com/alert-salesforce-standardcustom-object-page-layouts/

Thanks,
Tabrez

All Answers

SwethaSwetha (Salesforce Developers) 
HI Aidel,
Can you elaborate on your ask. What is the expected functionality of the field when the alert is popped up?Thanks
Aidel BruckAidel Bruck
I want a text field that sits on the page layout. Users can enter any text they want in this field and then when they open or refresh the record a small screen pops up on top of the record screen with the text entered in the field. There should be a button 'ok' on the alert screen. Clicking ok should close the top screen.
Shams TabrezShams Tabrez
Hi Aidel,

This process will be achieved using a custom field with datatype as a check box and a visualforce page. Please follow the below reference link.

https://www.salesforcetutorial.com/alert-salesforce-standardcustom-object-page-layouts/

Thanks,
Tabrez
This was selected as the best answer
Anand kurubaAnand kuruba
Hi,
please follow the links 
https://www.salesforcetutorial.com/alert-salesforce-standardcustom-object-page-layouts/
https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A9AXxSAN


thanks!!
Aidel BruckAidel Bruck
For future reference this is the visualforce page I created
In addition I created a text field called alert message for the users to enter the text they want to display.

<apex:page standardController="Customobj__c" showHeader="false">
<script>
window.onload = function()
{
if('{!Customobj__c.Alert_Message__c }'!='')
alert('{!Customobj__c.Alert_Message__c }');
}
</script>
</apex:page>