+ 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 https://gist.github.com/miragedeb/651dadd518cd19aef72c

Controller for the above https://gist.github.com/miragedeb/25f3054a7cc304f03ac8

Handling the condition on when to pop up the pagehttps://gist.github.com/miragedeb/d2a358420118df57ed74

Controller for the above https://gist.github.com/miragedeb/34aafd27de7360d946e3
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