Custom Function to Save and Re-Edit

Custom Function to Save and Re-Edit

If I understand correctly, a function cannot use values entered in a record's edit view until the changes have been saved.  This creates a problem when a function is needed while in conversation with a client and recording information in edit view.

So, how do I create a function that a function which saves any edits a the record in edit view and then reopens the record in edit view instead of detail view?

I can think of many situations where this would be useful.  For example, say I'm pre-qualifying a home buyer to see how much home they can afford BUT I'm not done editing the deal the information is recorded in.  I'd like to be able to enter values in fields including "Annual Household Income" and "Credit Score" and then click a button calling the function.  In this example, I would modify the function so that after the new deal is saved, it would perform the required calculations to calculate the maximum mortgage they could afford, save that value to a field in deals, and then bring me right back to that record's edit view so I can tell the buyer the amount they can afford before continuing the conversation and adding additional information to other fields in the edit view of the deal.

I know how to write the code to perform get the field data, perform the calculations and put a value into a field.  But I don't know how white code to save a record in edit view or navigate back to the edit view of the record.  How do I do those things?