You need to sign in to do that
Don't have an account?
divya1234
Redirect a page to custom object record page after alert message
I am trying to redirect to the custom object record page after action in persfored by lightning button
I am getting This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'setParams' of undefined] Callback failed: apex://ETre/AuarApexClass/ACTION$UserFunction Failing descriptor: {markup://c:MultiSelectLookup}
Helper: function(component, event, getInputkeyWord) { // call the apex class method var action = component.get("c.Function");// calling a method from aura enable class to persfor a opeation // set param to method action.setParams({ 'Records': component.get("v.NextRecords") }); // set a callBack action.setCallback(this, function(response) { var state = response.getState(); if (state === "SUCCESS") { var storeResponse = response.getReturnValue(); // if storeResponse size is equal 0 ,display No Records Found... message on screen. } if (storeResponse.length == 0) { component.set("v.Message", 'No Records Found...'); } else { component.set("v.Message", ''); // set searchResult list with return value from server. } component.set("v.UserList", storeResponse); alert('operation perfored Sucessfully'); // showing a message once operation is completed /// trying to redirect the page from lightning component page to record detai page var navEvent = $A.get("e.force:navigateToSObject"); navEvent.setParams({ recordId: component.get("v.objSobject").Id, slideDevName: "detail" }); navEvent.fire();
I am getting This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'setParams' of undefined] Callback failed: apex://ETre/AuarApexClass/ACTION$UserFunction Failing descriptor: {markup://c:MultiSelectLookup}
Well, the mentioned "e.force:navigateToSObject" & "sforce.one.navigateToSObject" still doesn't work in some cases. So you can try an alternative approach to redirect the user to the created page.
The alternative approach is to use lightning:navigation, (https://developer.salesforce.com/docs/component-library/bundle/lightning:navigation/documentation" target="_blank) salesforce document itself suggests to use this. Give it a try & if any issue occurs, please post it here.
Regards,
Sachin Hooda
(:
after
I doubt if navigation is causing any error. Can you please update your complete code, So we can assist you better.
_______
Regards,
Sachin
(: