Salesforce闪电了

问题描述 投票:0回答:1

我正在尝试从外部页面使用Salesforce组件。我继续本手册:https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_out_public_apps.htm但仍然有错误,没有任何渲染。我有404 for 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>

社区已创建。社区是公共的。社区可以访问应用程序。

什么是问题来源?

salesforce lightning
1个回答
0
投票

请尝试以下方法:

首先,您需要实现一种机制来在页面加载时触发脚本。使用以下,

<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行,请确认您使用的是正确的域格式,请参阅下面的示例。

对于SANDOXES使用: <script src="https://[custom-salesforce-domain-without-instance-number].lightning.force.com/lightning/lightning.out.js">

I.E. yaazkssvpoi

生产用途: <script src="https://FictiousCompany--SandboxName.lightning.force.com/lightning/lightning.out.js">

第17行(不包括空白行),确认您使用的格式正确,请参阅下面的示例。

对于SANDOXES和生产用途:<script src="https://login.salesforce.com/lightning/lightning.out.js">

I.E.没有AuthToken 'https://[custom-salesforce-domain-with-instance-info]/[CommunityName]', [If applicable, AuthToken]);

I.E.使用AuthToken 'https://Domain.cs59.force.com/DemoCommunity', );

我希望这有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.