function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Topher SympsonTopher Sympson 

e.force:editRecord not going to edit modal

I have a requirement where I need a component to override the 'New' record button and initially ask for two fields, the fields will be verified for any dups and then save those fields to a new record and then open up the new record's edit page. (Edit modal, same as clicking the Edit button on the record page.

At the moment I'm using e.force:editRecord but it just loads the new record page and not the edit page..


 
navigateToEditRecord: function(component, recId) {
        var navEvt = $A.get("e.force:editRecord");
        navEvt.setParams({
            "recordId": recId
        });
        navEvt.fire();
    },
verifyAndInitialSave: function (component, event) {
		component.set("v.siteRecord.BE__c", component.find('beEdit').get("v.value"));    
		component.set("v.siteRecord.Shipping_State__c", 
                component.find('stateEdit').get("v.value"));
		
		var tempRec = component.find("forceRecord");
		var self = this;
		tempRec.saveRecord($A.getCallback(function(result) {
			console.log(result.state);
			var resultsToast = $A.get("e.force:showToast");
			if (result.state === "SUCCESS") {
				// Call navigateTo Function here:
				var recId = result.recordId;
				self.navigateToEditRecord(component, recId);
				                
			} else if (result.state === "ERROR") {
				console.log('Error: ' + JSON.stringify(result.error));
				resultsToast.setParams({
					"title": "Error",
					"message": "There was an error saving the record: " + JSON.stringify(result.error)
				});
				resultsToast.fire();
			} else {
				console.log('Unknown problem, state: ' + result.state + ', error: ' + JSON.stringify(result.error));
			}
		}));

	}
Thank you for any help!
Best Answer chosen by Topher Sympson
Topher SympsonTopher Sympson
For the life of me whether a caching issue or what... I added a console log to make sure things were passing correctly and then it worked..........