简体   繁体   English

闪电组件中 createrecordevent 或 navigationlocation 上的 saveurl

[英]saveurl on createrecordevent or navigationlocation in lightning component

I have a similar code as below.我有一个类似的代码如下。

createRecord : function (component) {
    var createRecordEvent = $A.get("e.force:createRecord");
    createRecordEvent.setParams({
        "entityApiName": "Case",
    "panelOnDestroyCallback": function(event) {
           $A.get("e.force:navigateToSObject").setParams({
                   recordId: component.get("v.recordId"),
                   slideDevName: "detail"
            }).fire();
     }
    });
    createRecordEvent.fire();
} 

It does not redirect to the record id i have provided and this code is not even calling the function inside "panelOnDestroyCallback".它不会重定向到我提供的记录 ID,并且此代码甚至没有调用“panelOnDestroyCallback”中的函数。

I have also tried "navigationLocation": "LOOKUP" and I do know RELATED_LIST opens the same page i have called the createrecordevent.我也试过 "navigationLocation": "LOOKUP" 并且我知道 RELATED_LIST 打开我称之为 createrecordevent 的同一页面。

I have also tried url redirect too inside that "panelOnDestroyCallback".我也在“panelOnDestroyCallback”中尝试过url重定向。

panelOnDestroyCallback is not even getting called in the code. panelOnDestroyCallback 甚至没有在代码中被调用。

My intention is to send the page to account record detail page after it saved the case record which was opened from createrecordevent??我的目的是在保存从 createrecordevent 打开的案例记录后将页面发送到帐户记录详细信息页面?

e.force:createRecord will automatically redirect you to the new record after creation. e.force:createRecord将在创建后自动将您重定向到新记录。 No need to define a custom callback for that.无需为此定义自定义回调。

<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();
    }
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM