2

Pretty simple question I think - but I googled it and searched for it on Salesforce stack to no avail so far.

I have an inline VisualForce page (using the standard controller obviously) that sits inline in the middle of one of my Opportunity page layouts and dynamically renders specific fields depending on the type of Opportunity. They are all Opportunity fields, no cross object fields. However, when the user presses the standard Edit button on the record to modify the data, the inline Visualforce section doesn't appear on the standard edit page.

I know I can enable inline editing on the VF page, or add separate command buttons for edit/save, but is there any way for me to allow my users to edit the standard record data AND the inline VisualForce field data at the same time from the same screen?

  • 1
    Nope. Not possible. – Adrian Larson Jul 22 '16 at 15:07
  • Yeeah that's what I thought, I just wanted to exhaust all options before I gave up. I guess the only way to do it would be to override the edit page with a custom edit page that handles the same dynamic rendering. Thanks for the prompt response! @AdrianLarson – Morgan Marchese Jul 22 '16 at 15:09
  • Well... maybe... – Adrian Larson Jul 22 '16 at 15:23
2

Here is a suggested line of pursuit. No guarantees and I haven't tried it myself. I may later if I have time.

Try adding an onunload event listener to your inline page that saves the edits made from that page. You may need to use a @future method to avoid row locking issues. You can pass an entire object as a String using JSON serialization. You can lock the row in this method by re-querying for the record using a FOR UPDATE clause.

Who knows, it might even work.

|improve this answer|||||
  • 1
    and if this does work, whoever does this should document carefully in the VF markup how and why it works as the coordination won't be obvious to the next dev/admin inheriting the implementation – cropredy Jul 22 '16 at 17:08
  • Fair point. Hence why my knee-jerk reaction was that it's not possible. Probably somewhat unwise to implement this strategy, but it would be interesting to play with. Maybe you could add a window.confirm to verify the user wants to save the edits. – Adrian Larson Jul 22 '16 at 17:09

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.