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
Marine GustinMarine Gustin 

Display a pop up on a standard page if a criteria is met

Hello everyone,
I have a requirement to add a pop up to a standard page. When someone creates a new Lead and the Siret Code (custom field) is the same a the Siret Code of an existing account, a pop up should appear on the page, indicating that this Siret is already used.
Do you know how I could do this?
I thought about using a trigger, a custom controller, a controller extension or anything but I don't know how to articulate all of them.

Thank you for your help!
Marine
Best Answer chosen by Marine Gustin
DimondDimond
in your controller, you could just query for that value and if its present, then throw an exception or change a property to indicate then show the message in a popup. if you need an implementation, then you'll have to do a little more research on custom vf and apex. 

All Answers

DimondDimond
Wouldn't making the Siret Code field a unique field work?
Marine GustinMarine Gustin
Hi Dimond, thank you for your reply!
Yes probably, but my client wants a pop up to display anyway ... If I make it required, do you think I can display a pop up whenever the value of the field isn't unique?
DimondDimond
does it have to use the standard page also or are you allowed to create a custom page?
Marine GustinMarine Gustin
No I can create a custom page if needed!
DimondDimond
Then I would suggest going that route. It'll save you a lot of headaches down the road if more changes are required. 
Marine GustinMarine Gustin
Ok thanks for your answer, and how would you proceed with this custom page?
DimondDimond
in your controller, you could just query for that value and if its present, then throw an exception or change a property to indicate then show the message in a popup. if you need an implementation, then you'll have to do a little more research on custom vf and apex. 
This was selected as the best answer
Marine GustinMarine Gustin
Okay, thanks a lot! :)