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
JNicJNic 

quick question on calling pageref within pageref

Hey all... I have a bunch of page refs that do separate things, but send the user back to the same page each time.

 

 

Is there a way to call one page ref within another?

 

example:

 

Public PageReference viewRecord() { PageReference toPage = page.myPage; toPage.getParameters().put('id', my.id); toPage.setRedirect(true); return toPage; } public pageReference doSomething() { integer iAxns, ia; integer numSelectedAxns = selectedAxns.size(); //Loop through the contacts one by one and set them up for ( ia = 0;ia < numSelectedAxns; ia++ ) { IMACtion__c axnToGet = selectedAxns.get(ia); //Now map the fields axnToGet.Shipment_status__c = 'Wow it worked!'; } //Then insert the contacts update actions; //So assuming all that works... let's go look at our record

...Can I call the other page ref right here? How?
}

 See what I mean?

 

 

Thanks!

 

 

Best Answer chosen by Admin (Salesforce Developers) 
ColinKenworthy2ColinKenworthy2

Since doSomething() should return something you could simply add

 

return viewRecord();

 

 

 

All Answers

ColinKenworthy2ColinKenworthy2

Since doSomething() should return something you could simply add

 

return viewRecord();

 

 

 

This was selected as the best answer
JNicJNic

Yup... I'm a fool...

 

Thanks!