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
samrat.1985@lntinfotechsamrat.1985@lntinfotech 

I need to provide a popup every time a new entry is made

Hi

 

I have an application that displays data from a WSDL. Now the require ment is that whenever a new entry is made the user should get a pop up that there is a new entry. I have achieved refreshing using action poller i want to add a pop up which will alert the user that a new record has come.

 

Please help its little urgent

Best Answer chosen by Admin (Salesforce Developers) 
sinsiterrulezsinsiterrulez

 

<script>
function update()
{
if("{!showalert}")
	alert("New record inserted");
}
</script>

<apex:actionPoller action="{!Actionmethod}" oncomplete="update();" rerender="counter" interval="15"/>

 How it helps

 

All Answers

samrat.1985@lntinfotechsamrat.1985@lntinfotech

I have gone through most of the posts but m unable to find an answer for my requirement.

See my action poller refreseh the page block table and i want that every time it is refresehd the popup should appear

bob_buzzardbob_buzzard

Presumably your action poller is executing a method on the controller?

 

If that is the case, you can set a property in the controller, something like displayPopup, to true if the popup should be displayed.

 

Then in your page you'd have an output panel that is rendered if displayPopup is true, which runs some javascript to create the popup.

 

We've done something similar to refresh a record detail page from an embedded visualforce page.

sinsiterrulezsinsiterrulez

You can set a variable in controller if record is added & by using oncomplete attribute in actionpoller you can show the popup update to user

samrat.1985@lntinfotechsamrat.1985@lntinfotech

Hi   

I would be very greatful if you can give a smal example of how to use the onComplete property.

I am trying but i am unable to get the result.

Please help

sinsiterrulezsinsiterrulez

 

<script>
function update()
{
if("{!showalert}")
	alert("New record inserted");
}
</script>

<apex:actionPoller action="{!Actionmethod}" oncomplete="update();" rerender="counter" interval="15"/>

 How it helps

 

This was selected as the best answer
Pradeep_NavatarPradeep_Navatar

You can use actionpoller with actionstatus with attribute onstart and onstop so that invoke javascript function for popup window.

 

<apex:actionPoller interval="5" rerender="status" status="sref"/>
<apex:actionStatus id="sref" onstart="start()" onstop="stop() " />
</apex:outputPanel>
<script>
    function start()
    {
        
          var url='/apex/ma4';   
          window.open(url,"Homepage","resizable=yes,status=yes,scrollbars=yes,width=400,height=200,target=_blank");
    }
</script>

 

Hope this helps.

samrat.1985@lntinfotechsamrat.1985@lntinfotech

hey

thank you very much...It works :smileyvery-happy: