0

We are not using Lightning, but recently transitioned to using the new 'enhanced note-taking tool'.

We use a VF page for our Opportunity object, and have the new Notes related list on our page:

<apex:relatedList list="AttachedContentNotes" subject="{!opp}"/>

When I click the standard 'New Note' button from this page, however, this is the URL for the note page (emphasis mine):

https://na29.salesforce.com/06934000001xv4A?retUrl=%2Fapex%2Fopportunitybyproducts&parentId=00634000013LYpj

This retURL causes an error when hitting the 'Cancel' button on the Note page, because you can't just return to a VF page without a record ID parameter.

Clicking into an existing note provides a working retURL, however:

https://na29.salesforce.com/06934000001xv5h?parentId=00634000013LYpj&retUrl=/00634000013LYpj

I believe the fix is to change retURL to '/{oppID}', but I'm not sure how to do that without building an entirely new visualforce component to replace the Notes related list. Is there a simpler solution?

1

Found the known issue, copy pasted below: https://success.salesforce.com/issues_view?id=a1p3A000000jkoaQAA

Cancel button on Visualforce Page having Enhanced Notes related List does not respect returnURL

Apex , Spring 16 , Summer 15 , Summer 16 , Winter 16

Last updated 12 days ago ·Reference W-2826983 ·Reported By 4 users IN REVIEW

Summary When a Related List is created on a VF Page for Notes records, using , it contains "Save" and "Cancel" buttons which are displayed after we click on "New Note" button to create a Note record.

When the "Cancel" button is clicked, the User is redirected to the VF page, but the URL does not contain the ID of the record in the URL.

So, if the URL when the VF Page was loaded was https://.salesforce.com/apex/myVFPage?id=

and the "Cancel" button is clicked, the User is redirected to :

https://.salesforce.com/apex/myVFPage

The same thing happens when you click on "Save" button and then "Cancel" button, the Note record gets saved but the redirection works in the same way mentioned above.

Repro In any Org :

  • Get the ID of any Account record and go to this URL :

https://.salesforce.com/apex/MyVfPage?id=

  • Now click on "New Notes".

  • On the screen which has opened, click on "Cancel" (Or You can click on "Save" and then "Cancel").

  • You will notice that the User is redirected to the VF page, but the URL does not contain the ID : https://.salesforce.com/apex/MyVfPage

Workaround Use "Back" button of browser to go to the previous page.

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.