You need to sign in to do that
Don't have an account?
Jugbeer Bhola
Alert or Notification Message Approach
I am in the lightning environment using a standard page layout. I have created a ‘Detail Page Button’ tied to a content source of ‘Visualforce Page.’ The Visualforce page executes from the custom button to call a web service. What I would like to happen is an alert informing the user the web service call out is complete. I would like a JavaScript message of ‘Success’ or ‘Failure.’ There cannot be an ‘apex:command button’ or anything that will make the ‘Visualforce Page’ display.
If it cannot be JavaScript message any type of message will be OK.
The apex:pagemessage will not work because the ‘Visualforce Page’ is never, and should never, displayed. The only reason it exists is to call Apex.
Many different attempts at firing JavaScript from the controller have failed. I am guessing it is locker service blocking the functionality.
Has anyone found a solution for this? This seems like it would be pretty common to do this.
The user wants to use standard pages.
I have added my current page and controller.
If it cannot be JavaScript message any type of message will be OK.
The apex:pagemessage will not work because the ‘Visualforce Page’ is never, and should never, displayed. The only reason it exists is to call Apex.
Many different attempts at firing JavaScript from the controller have failed. I am guessing it is locker service blocking the functionality.
Has anyone found a solution for this? This seems like it would be pretty common to do this.
The user wants to use standard pages.
I have added my current page and controller.
<apex:page standardController="Account" extensions="AccountExtController" action="{!executeCall}"> </apex:page>
public class AccountExtController { private ApexPages.StandardController standardController; private Id acctID; public AccountExtController(ApexPages.StandardController standardController) { acctID = standardController.getId(); } public PageReference executeCall() { String responseMessage = accountCallOutHelper.executeRequest('POST', 'getsomestuff', acctID); //W A N T T O F I R E A M E S S A G E H E R E! return new pagereference(url.getsalesforcebaseurl().toexternalform()+'/'+ acctID); } }
Greetings!
I don't think you need to display anything with the VF page in order to invoke ApexPages message.So,I would suggest you to use apexPages.addMessage to display after making the callout.
Please refer the sample code provided below:
https://developer.salesforce.com/forums/?id=906F00000008ktQIAQ
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri