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

Pop-up alert showing multiple times on case page layout

We need to create Pop-up alert on Case page. We have created Visualforce page with Javascript code for calling alert and placed the Visualforce page in standard case page layout.
When we are opening case, Pop-up alert is getting displayed. However when we do any modifications to the case and save the case, Pop-up alert is again getting called. Is there any way that Pop-up gets called only when we open the case and not when we save the case?
Its highly likely there is a way to stop this.  However, unless you tell us how you are producing the popup alert the chances of us guessing right are pretty low.

Can you share the code/markup?
This is the Visualforce code
<apex:page standardController="Case" extensions="CaseContactPopUpController" rendered="{!Case.ShowPopup__c=true}">
<apex:form >
var Message = '{!strMessage}';

I am populating strMessage from controller class and I have formula field from Case. If it is true, I am displaying Popup. When I open case or save case, this formula will be true, hence popup is getting displayed multiple times.
I'm assuming that this is embedded in the standard case view page?  In that case you'll need to do something to change the ShowPopup__c field to false when you save the case, as the page will be reconstructed each time so there is no way for it to know that the popup has already been shown.
I have place Visualforce page on standard case page layout. If I change ShowPopup formula to false after save, I will be able to restrict Popup after save but when case will be opened again, ShowPopup will be false and Popup will not be displayed.
Surya KiranSurya Kiran

Use future method to make that field as true. It works in this way.

1. Once you save the record make the field as false and at the same time call the future method which will make the field as true.
2. Display alert message when field is true.

**** If executing future method with trigger better to use after trigger in this case.

It may help you.
Nati KirenNati Kiren

could you write the CaseContactPopUpController controller