0

Use case:

  • SFDC Classic
  • Standard page layout for object Foo__c. No embedded VF pages.
  • Custom detail page button 'Close Me' that is associated to a Visualforce page CloseMe.page
  • Object-specific Quick Action Close Me that is associated to same Visualforce page CloseMe.page

Starting condition:

  • Foo__c.Status__c = Draft

User action and result:

  • User refreshes page using browser
  • Status changes to Closed

But no button was ever clicked!?!

Checking the debug log one can see that the VF page is being executed as /apex/CloseMe.page shows in the log. But, again, user never clicked the button nor the Quick Action.

How can this be?

1 Answer 1

0

First of all, the standard page layout had no embedded VF pages so simply refreshing the detail page wasn't causing any page layout VF pages to execute via controller or page action methods. The View standard operation was not overridden by any VF page.

Diagnosis

  1. If I removed both the detail page button and the object-specific Quick Action, the problem went away.
  2. If I put the detail page button back in (but not the object-specific Quick Action), the problem did not recur
  3. If I put the object-specific Quick Action back in, the problem recurred only if the object's feed was open (i.e. - not hidden)

Analysis

  • The VF page had a pageaction method that would close the Foo__c unless it wasn't ready to close - in which case the VF page would display with the relevant reason for why the Foo couldn't be closed

When the Chatter Feed is visible, SFDC will actually load the VF Page associated to the Quick Action and hence execute its pageAction method! I'm not completely clear why this happens as one would expect the page to only load when the Quick Action was actually clicked - but that does not seem to be the case.

The solution

  • Don't use pageAction methods on VF pages associated to object-specific Quick Actions
  • Read and follow the documentation - the interaction model for object-specific Quick Actions should follow guidelines here - and use action methods associated to buttons on the VF page. In particular, the example shows (using Javascript), how to properly rerender after the action completes.
  • Or, redesign the application to better use Separation of Concerns pattern and let the domain layer decide if the object can be closed. This way, you can use Quick Actions with default values and, if an error occurs in update, the error gets surfaced back to the Chatter Publisher.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .