Skip to main content
added 337 characters in body
Source Link
Nagendra Singh
  • 9.1k
  • 6
  • 29
  • 60

Use navigation api in combination with your workspace api.

Like this:

handleRecordTypeSelection: function (component, event, helper) {
    var recordTypeName = event.getSource().get("v.value");
    component.set("v.caseField.RecordTypeId", recordTypeName);
    component.find("caseRecordCreator").saveRecord(function (saveResult) {
        if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
            var workspaceAPI = component.find("workspace");
            workspaceAPI.openTab({
                recordId: saveResult.recordId, 
                focus: true
            }).then(function() {
                navigatorApi.navigate({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: saveResult.recordId,
                        actionName: 'edit'
                    }
                })
            })
        }
    })
}

Or Like this ;

workspaceAPI.openTab({
    recordId:  v,
    focus: true
 }).then(function() {
    var editRecordEvent = $A.get("e.force:editRecord");
    editRecordEvent.setParams({
        "recordId": v
    });
    editRecordEvent.fire();
 })

Use navigation api in combination with your workspace api.

Like this:

handleRecordTypeSelection: function (component, event, helper) {
    var recordTypeName = event.getSource().get("v.value");
    component.set("v.caseField.RecordTypeId", recordTypeName);
    component.find("caseRecordCreator").saveRecord(function (saveResult) {
        if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
            var workspaceAPI = component.find("workspace");
            workspaceAPI.openTab({
                recordId: saveResult.recordId, 
                focus: true
            }).then(function() {
                navigatorApi.navigate({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: saveResult.recordId,
                        actionName: 'edit'
                    }
                })
            })
        }
    })
}

Use navigation api in combination with your workspace api.

Like this:

handleRecordTypeSelection: function (component, event, helper) {
    var recordTypeName = event.getSource().get("v.value");
    component.set("v.caseField.RecordTypeId", recordTypeName);
    component.find("caseRecordCreator").saveRecord(function (saveResult) {
        if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
            var workspaceAPI = component.find("workspace");
            workspaceAPI.openTab({
                recordId: saveResult.recordId, 
                focus: true
            }).then(function() {
                navigatorApi.navigate({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: saveResult.recordId,
                        actionName: 'edit'
                    }
                })
            })
        }
    })
}

Or Like this ;

workspaceAPI.openTab({
    recordId:  v,
    focus: true
 }).then(function() {
    var editRecordEvent = $A.get("e.force:editRecord");
    editRecordEvent.setParams({
        "recordId": v
    });
    editRecordEvent.fire();
 })
Source Link
Nagendra Singh
  • 9.1k
  • 6
  • 29
  • 60

Use navigation api in combination with your workspace api.

Like this:

handleRecordTypeSelection: function (component, event, helper) {
    var recordTypeName = event.getSource().get("v.value");
    component.set("v.caseField.RecordTypeId", recordTypeName);
    component.find("caseRecordCreator").saveRecord(function (saveResult) {
        if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") {
            var workspaceAPI = component.find("workspace");
            workspaceAPI.openTab({
                recordId: saveResult.recordId, 
                focus: true
            }).then(function() {
                navigatorApi.navigate({
                    type: 'standard__recordPage',
                    attributes: {
                        recordId: saveResult.recordId,
                        actionName: 'edit'
                    }
                })
            })
        }
    })
}