1

On Cpq Editlines page i have added a custom action (Button). Onclick of this button, it will redirect to a visualforce page, inside which my lighting component works. On the lightning component after save I am not able to redirect back to CPQ editlines page. I have use $A.get("e.force:navigateToURL") but this is not working neither giving any error below is the code to fire the event.

var pageUrl = "https://sbqq.ap16.visual.force.com//apex/sbscontrolCaching=1&id="+component.get("v.recordId");
                 var urlEvent = $A.get("e.force:navigateToURL");
                    urlEvent.setParams({
                        "url": pageUrl,
                        "isredirect": "true"
                    });
                    urlEvent.fire(); 
  • 2
    Hi and welcome to SFSE. Please could you edit your question to add detail about what happens ("is not working" does not provide enough explanation) and also indicate the context of use (is this in a community or not). It might be helpful if you read How to Ask which provides some help around the best way to go about asking a question to get a good answer (including how to show you've done your research). – Phil W Mar 11 at 7:26
  • Whilst it isn't discussing exactly what you are doing, and relates to LWC rather than Aura, you may find the basic approach taken in this answer might help you on your way. – Phil W Mar 11 at 7:33
  • In Cpq Editlines page which is a visualforce page, i have added a custom action (Button). – Sumit Singh Mar 11 at 7:37
  • You say it doesn't give an error, but just what does happen? What URL does it actually try to take you to? What is the actual URL that works? (btw, hard-coding the URL to the VF page is a bad idea as this won't work without change in a sandbox vs production. You need to use Salesforce APIs to obtain the page URL - something covered in the answer I referenced above.) – Phil W Mar 11 at 8:13
2

The reason for this is most of the standard force:* events do not work when the component is opened from a VF page even if you add it as a dependency.

As a workaround use Window.postMessage or Lightning Messaging Service depending on your use case and conditionally show/hide the component on the same page.

I would also recommend you to consider the possibility of completely getting rid of VF pages and directly use an Aura/LWC component

| improve this answer | |
  • 1
    Thank you it worked for me. – Sumit Singh Mar 11 at 12:06

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.