You need to sign in to do that
Don't have an account?

PageReference using Apex - hopefully a simple question
I create a Visual force page to call an apex controller to create a new object. Basically creating a Contract from the Account via a button so I can control some of the default values in the Contract, based on the Account.
However, there is one piece, the Contact, that I cannot predetermine as there are many contacts on an account typically. So, what I wanted to do was have the PageReference open in Edit mode. I was able to do that easily. So here are the page references and results
return new PageReference('/'+c.Id);
This lands on the new Contract, but is not open for editing.
return new PageReference('/'+c.Id+'/e');
This lands on the new Contract in Edit Mode. Which is correct, because I then made the Contact Signed By field required and the only editable field on the page - so the requestor can complete it.
However, after entering the Contact and saving the record again, the user is brought to the Home Page, not the Contract record. Is there anyway I can control where the save takes them? A second PageReference maybe?
retURL= {id.of.where.u.want.to.go}
not sure if this works , is how i would try it if setting the url in a custom button or something
All Answers
retURL= {id.of.where.u.want.to.go}
not sure if this works , is how i would try it if setting the url in a custom button or something
Thank you so much. Simple as I had hoped. For the official record, here is the new pagereference in its working entirety
return new PageReference('/'+c.Id+'/e?retURL=/'+c.Id);