You need to sign in to do that
Don't have an account?
Amanda Byrne- Carolina Tiger Rescue
Close the extra browser window that opens for an external link in salesforce1
I'm trying to finish up an app created for Salesforce1. The app inludes a getFeedback survey- which works by an output link button that sends the user to the survey. Once the user has completed the survey, I would like them to return to a confirmation page that tells them they are done.
I initially tried putting the survey in an iframe, but couldn't get out of the iframe once in it. Instead, I set the redirect feature of the survey to go to the confirmation page with all the necessary parameters. I'm limited is how I can use that redirect, since I can only define it with the URL in the survey administration. This plan worked great on my pc- the user could progress through the app, continue through the survey, and return to the app all within the same window.
But in Salesforce1, when my output link goes to the survey, it opens in a new browser window kind-of 'within' Salesforce1, so at the end of the survey, the user goes to the correct VF page- but it's in the new window launched by the survey, and the old window is still underneath.
The external link opening in a new window is an intentional feature of Salesforce1- but I need to create a way to close that window and redirect to the correct page in the parent window at the end of the survey.
Here's the code I'm currently using for the button to go to the quiz.
I initially tried putting the survey in an iframe, but couldn't get out of the iframe once in it. Instead, I set the redirect feature of the survey to go to the confirmation page with all the necessary parameters. I'm limited is how I can use that redirect, since I can only define it with the URL in the survey administration. This plan worked great on my pc- the user could progress through the app, continue through the survey, and return to the app all within the same window.
But in Salesforce1, when my output link goes to the survey, it opens in a new browser window kind-of 'within' Salesforce1, so at the end of the survey, the user goes to the correct VF page- but it's in the new window launched by the survey, and the old window is still underneath.
The external link opening in a new window is an intentional feature of Salesforce1- but I need to create a way to close that window and redirect to the correct page in the parent window at the end of the survey.
Here's the code I'm currently using for the button to go to the quiz.
<apex:outputLink id="postTourQuizButton" styleClass="btn" value="https://www.getfeedback.com/r/{!surveyid}?CnP_PaaS_EVT__Event_attendee_session__c={!selectedAttendeeButtonId}"> What did you Learn about Wildcats? </apex:outputLink>
Empower your Salesforce1 solution with DeepLink - http://https://developer.salesforce.com/blogs/isv/2015/01/empower-salesforce1-solution-deep-link.html
Salesforce1 Deep Link schemes - http://bit.ly/s1deeplinking
1. I tried changing the URL redirect at the end of the survey to salesforce1:/DCTI_Event_Page; however the form field that getFeedback uses to specify the URL for a redirect does not allow "salesforce1:/..." . I can sort of get around this by setting the getFeedback redirect URL to https://salesforce1:/DTCI_Event_Page, which returns me to the correct page; however, it's still in the top window.
2. I tried setting the getFeedback redirect to the page where the survey was launched with a parameter to indicate the survey was complete, and then use javascript to redirect to "salesforce1:/DTCI_Event_Page", but again- this does not close the top window.
if(qstatus == "complete"){
window.location = "salesforce1:/DTCI_Event_Page_AB?qstatus=complete";
self.close();
};
The use case in your example (https://developer.salesforce.com/blogs/isv/2015/01/empower-salesforce1-solution-deep-link.html) reference looks to be very similar to what I'm doing; however, it did not include any sample code about how it works.