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
Scott0987Scott0987 

refresh visualforce page and clear all data

I have a visualforce page with some input fields.  The page has a save button that inserts the data into salesforce.  here is the code for the save button.

    insert olListF;
    PageReference pageRef = new PageReference('/apex/rma_addLineItems?orid=' + o.id);
    return pageRef;

 /apex/rma_addLineItems?orid=' + o.id is the current input page.  

 

I want the page to return to the exact same page and remove any fields that had been put in.  The idea behind the page is it will allow someone to input 5 items and then either save them and move on or save them and add 5 more.  It is the add 5 more option that is not working.  It refreshes the page with the fields already filled out.  Any ideas on how to accomplish my goal?  

Best Answer chosen by Admin (Salesforce Developers) 
AquilaDeveloperAquilaDeveloper

 

add this line before return statement

 

pageRef.setRedirect(true);

All Answers

AquilaDeveloperAquilaDeveloper

 

add this line before return statement

 

pageRef.setRedirect(true);

This was selected as the best answer
Scott0987Scott0987

Thanks that did it.