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
Mayank Srivastava (Salesforce fan)Mayank Srivastava (Salesforce fan) 

How to display a VF popup only when a record is created and not edited?

I am trying to show the user a popup only when the record is created. For every subsequent edit and save, the popup shouldn't be displayed. I have created 2 VF pages and 2 controllers so far and now I need some guidance on how to display this popup(QADuplicateAlert) only when a record is newly created.

Since I am passing the Id of my current page/record into the controller, the popup is displaying every time I edit something and save the page. Instead, I want this popup to only appear when the record is created the first time.

Any help is much appreciated!

Main Popup Page

Controller for the above

Handling the condition on when to pop up the page

Controller for the above
Akshay DeshmukhAkshay Deshmukh
if you are overriding new and edit buttons. then you can pass a additiional parameter in URL and check it in controller.
In this case you do not require 2 pages/controller.

In user clicks on edit add "/isEdit=true" in url and check in controller for "isEdit" parameter. If it is true then user has clicked edit button. else new button.

Hope it helps