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
Bryan HuntBryan Hunt 

Javascript button converted to Lightning Component does not work


I have a problem exactly the same as in this post:

We have a javascript button in classic. Using the Lightning Experience Configuration Converter, a lightning component and controller were automatically generated. However, the new action button generated by Salesforce and placed on the page layout does not seem to be working.

The button is clicked and the component modal pops up for a second, then quickly goes away and goes to an invalid record page.

Unfortunately no solution was posted for the issue.

Button is pressed, modal dialog box appears, apex code is called, records are updated properly.  All of that is fine.  But at the end of all of it, it is supposed to pop up an alert box giving the status.  Then the prior record screen should be shown after a refresh.  The modal dialog box disappears and we see the "this page isn't available in salesforce lightning experience or mobile app" message on the background screen.

Thanks for any help in resolving this.

Bryan Hunt
ShirishaShirisha (Salesforce Developers) 
Hi Bryan,


Seems like the Javascript button has converted partially which means you will need to review the generated code and add the code which is missing according to your business logic.

You will need to use navigateToUrl in the lightning component to redirect to the Vf page which is as below:
var urlEvent = $A.get("e.force:navigateToURL");
              "url": "/apex/VfPageName",
              "isredirect": "true"

Please refer the below thread for the sample code:

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri

Thank you for the reply.  Your suggestion was not the exact issue, but it did lead me down the right path.

While working on that, I see that SFDC is now recommending 'standard__recordPage' as the new method for navigating to a page now?  Have you tried that as well?


Bryan Hunt