闪电组件中createrecordevent或navigationlocation上的saveurl

问题描述

我有如下类似的代码

<img src="SomeImage.jpg" onerror="this.remove();" 
     alt="Some Image" width="100" height="120">
<br>
<span id="loadErrorSpan" style="font-family: sans-serif; 
   font-size:18px;text-align: center;color: #666;">Loading...Please wait</span>

它不会重定向到我提供的记录ID,并且此代码甚至都没有调用“ panelOnDestroyCallback”内部的函数

我也尝试过“ navigationLocation”:“ LOOKUP”,我确实知道RELATED_LIST会打开我称为createrecordevent的同一页面

我也在“ panelOnDestroyCallback”中尝试了网址重定向

panelOnDestroyCallback甚至没有在代码中被调用

我的意图是在保存从createrecordevent打开的案例记录后将其发送到帐户记录详细信息页面

解决方法

e.force:createRecord将在创建后自动将您重定向到新记录。无需为此定义自定义回调。

<aura:component implements="flexipage:availableForAllPageTypes">
    <lightning:button label="Create Case" variant="brand" onclick="{!c.createRecord}"/>
</aura:component>
({
    createRecord : function (component,event,helper) {
        var createRecordEvent = $A.get("e.force:createRecord");

        createRecordEvent.setParams({
            "entityApiName": "Case"
        });

        createRecordEvent.fire();
    }
})