[英]Salesforce lightning out
我正在嘗試從外部頁面使用Salesforce組件。 我繼續閱讀本手冊: https : //developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_out_public_apps.htm,但仍然有錯誤且未呈現任何內容。 我有404用於inline.js和bootstrap.css。
我的代碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>LIG Boilerplate</title>
<script src="https://custom-salesforce-domain/externalApps/lightning/lightning.out.js"></script>
<script>
let inputVariables = [];
$Lightning.use("c:SGMVAOutside", function() {
$Lightning.createComponent("lightning:flow", {},
"container",
function (component) {
component.startFlow("SG_MVA_Triage_Flow_Lightning_Out", inputVariables);
})
;},
'https://custom-salesforce-domain/externalApps'
);
</script>
</head>
<body>
<p>It works !!!</p>
<div id='container'>
</div>
</body>
</html>
社區已創建。 社區是公共的。 社區有權訪問應用。
什么是問題源?
請嘗試以下操作:
首先,您需要實現一種在頁面加載時觸發腳本的機制。 使用以下內容,
<script> function init(){ let inputVariables = []; $Lightning.use("c:SGMVAOutside", function() { $Lightning.createComponent("lightning:flow", {}, "container", function (component) { component.startFlow("SG_MVA_Triage_Flow_Lightning_Out", inputVariables); }) ;}, 'https://custom-salesforce-domain/externalApps' ); } </script> </head> <body onload="init()"> <p>It works !!!</p> <div id='container'> </div> </body>
對於第8行,請確認您使用的域格式正確,請參見以下示例。
對於三氧化二使用:
<script src="https://[custom-salesforce-domain-without-instance-number].lightning.force.com/lightning/lightning.out.js">
IE
<script src="https://FictiousCompany--SandboxName.lightning.force.com/lightning/lightning.out.js">
供生產使用:
<script src="https://login.salesforce.com/lightning/lightning.out.js">
第17行(不包括空白行),請確認您使用的格式正確,請參見以下示例。
供桑多克斯和生產使用: 'https://[custom-salesforce-domain-with-instance-info]/[CommunityName]', [If applicable, AuthToken]);
沒有AuthToken的IE
'https://Domain.cs59.force.com/DemoCommunity', );
帶有AuthToken的IE
'https://Domain.cs59.force.com/DemoCommunity', 12345789ABCDEF );
我希望這有幫助!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.