How to do these two things same in LWC?


PageReference return type is not valid in LWC what to do for it I have a return type mentioned below how to do same in LWC

return PageUtils.redirect(returl); 

You will have to significantly refactor your approach, but it should be doable using the LWC NavigationMixin. You can use this to add parameters to the URL (note that adding them through the state in the URL creation is a bit strange as it "namespaces them" but it is still possible to bypass this by putting them directly on the URL instead, at time of writing) and you can use it to "navigate" to a different URL (both lightning pages and others).

If you want to be able to pass parameters to a Visualforce page presented in the Lightning Experience, or navigate within a Lightning Community, then you do need to jump through various hoops. You can see how this is done here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.