• Ying Ding 6
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi, I am a newbie to SFDC, and very excited learning tons of new stuff here. Now I have a question that, if I have a controller which serves as REST API Web Service endpoint and receiving the external parties' post information. can I trigger some actions such as popup/alert in the associated VF page?

Part of my code is pasted below.I was trying to trigger the popup by calling the action function in the httppost function, but failed. Can somebody please help me? Any advice will be very appreciated. Thank you!
--Controller
  @HttpPost
  global static boolean getPost(String matrics) {
        boolean received = false;
        Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(matrics);
        postID = (String)params.get('ID');
        userId = 'myid123';
        if(userID.equals(postID)){ 
            received=true;
            showPopup(); //change the displayPopUp from false to true
        }else{
            received=false;
           closePopup();//change the displayPopUp from  true to false
        }
        return received;
    }   

--VF Page
        <apex:outputPanel id="TestPopup">
        <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}"/>
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}">
                This is where I would put whatever information I needed to show to my end user.<br/><br/><br/>
                <apex:commandButton value="Hide Pop up" action="{!closePopup}" rerender="TestPopup"/>
            </apex:outputPanel>
        </apex:outputPanel>