-
-
Save winniecluk/dfea14410515dba2ad40401487a46a86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$Lightning.use("c:accountEquipmentApp", function() { | |
$Lightning.createComponent( | |
"c:accountEquipment", | |
{ recordId : "{!Account.Id}" }, | |
"lightning", | |
function() { | |
$A.eventService.addHandler({ "event": "c:redirectToRecord", "handler" : redirectPage}); | |
} | |
); | |
}); | |
</script> | |
<script> | |
var redirectPage = function(event){ | |
var recordId = event.getParam("recordId"); | |
var target = event.getParam("target"); | |
console.log(recordId.substring(3)); | |
// console.log(sforce.one); | |
// debugger; | |
console.log('tablet check'); | |
if ( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ){ | |
if ( recordId.substring(3) == '001' ){ | |
sforce.one.navigateToSObject(recordId); | |
} else { | |
sforce.one.editRecord(recordId); | |
} | |
} else { | |
var url = "/"+recordId; | |
if ( recordId.substring(3) != '001' ){ | |
url += "/e"; | |
} | |
if ( target == "_blank" ){ | |
window.open(url,'_blank'); | |
} else { | |
window.location = url; | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment