I'm trying to troubleshoot a problem in a Salesforce1 app. Basically app lets you check-in in an account with Salesforce1 app. By check-in it creates a event tied to this account and redirects to the event page. Problem is while redirecting it uses salesforce web link style. It redirects from emea.lightning.force.com/… to emea.salesforce.com/… and in this page we are not able to do any changes.
Code for creating event and redirecting to event page:
myNewEvent.WhatId = mkn.Id;
DateTime dt = DateTime.now();
myNewEvent.StartDateTime = dt.addHours(2);
myNewEvent.Subject = 'Check-in ' + myNewEvent.StartDateTime;
myNewEvent.EndDateTime = myNewEvent.StartDateTime.addMinutes(1);
myNewEvent.OwnerId = UserInfo.getUserId();
myNewEvent.Location = String.valueOf(mkn.Location__Latitude__s) + ' ' + String.valueOf(mkn.Location__Longitude__s);
myNewEvent.EventCurrentLocation__c = latpg + ' ' + lonpg;
insert myNewEvent;
PageReference pr = new PageReference('/' + myNewEvent.Id);
pr.GetParameters().Put('message', 'Event added successfully');
pr.setRedirect(True);
return pr;
This check-in page (basically a map with markers on it) throws this error on javascript console: "Refused to connect to 'https://emea.salesforce.com/javascript/source?lastMod=1418031882000&fileName=CanvasRendering.js.map&projectPath=canvas' because it violates the following Content Security Policy directive: "connect-src 'self'"."
Also when returning to event page javascript console gives this error: "AuraAlohaFrameNavigator.js:6 Uncaught SyntaxError: Failed to execute 'postMessage' on 'Window': Invalid target origin 'undefined' in a call to 'postMessage'."
Any help on this would be appreciated since there is not much document on lightning and I'm not really familiar with it.
Best Answer
Take a look at Salesforce's documentation on navigation. I believe you will have to use something like: