2

We've been experiencing an issue just after Winter '21 that on objects that have been overridden by a Visualforce Page for New button, the New action only works first time, if users instead of clicking Save, clicks Cancel button then user has to logout and log back in to use the New action button on that object, as the Visualforce page renders only first time, and then it always renders as blank page (total white page).

We checked from Browser's Console and verified if the Visualforce page exist in DOM, and found that the iFrame hosting the page does exist but BODY of the iFrame is totally empty.

I know this falls into a development related stuff and Salesforce would simply close down the support case, so I'm here asking if anyone else has been experiencing the same behavior?

Visualforce Page code to reproduce the Bug:

<apex:page standardController="Account">
    <apex:form id="frmAccount" >
        <apex:pageBlock title="Account Summary">
            <apex:pageBlockSection columns="1">
                
                <apex:inputField value="{!Account.Name}"/>
                <apex:inputField value="{!Account.Phone}"/>
                <apex:inputField value="{!Account.Industry}"/>
                <apex:inputField value="{!Account.AnnualRevenue}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="cancel"/>
            </apex:pageBlockButtons>
        </apex:pageBlock> 
    </apex:form>
</apex:page>

Steps to reproduce the bug:

  1. Create a Visualforce Page (use code above)
  2. Set the Visualforce Page as New action button override on the Account object
  3. Test within Lightning Experience environment
  4. Go to Accounts tab
  5. Click New button.
  6. When the Visualforce opens up, click Cancel button.
  7. It will take you back to Accounts tab.
  8. Click New button again.
  9. It will again open the Visualforce Page, but it will be rendered as a blank page.
  10. Either refresh the browser or logout/login and repeat steps #4 to #9.

==========================

UPDATE: Salesforce Support confirmed the bug (known issue link is still awaited), but the issue is currently being deployed in phases to instances, the platform version 228.11.1 patch release is supposedly being deployed with this specific issue to all users.

1
  • Very weird behavior. Adding an empty rerender like rerender="forceRender" to cancel button resolves the issue but I am not sure if this is a bug or a "feature". – tugce Oct 27 '20 at 18:55
0

I have found a workaround for this bug(I think so) Try these steps.

1.You need a Redirect Page(This is important) and override standard new button by this page.

    <apex:page standardController="Account" >
        <script>
            window.addEventListener('load', e => {
                setInterval(redirect, 100);
                
            });    
            function redirect() {
                sforce.one.navigateToURL('/apex/Account', true);
            }
               
        </script>
    </apex:page>

2. Change your code like below

    <apex:page standardController="Account">
        <script>
            function back() {
                sforce.one.back();
            }
        </script>
        <apex:form id="frmAccount" >
            <apex:pageBlock title="Account Summary">
                <apex:pageBlockSection columns="1">
                    
                    <apex:inputField value="{!Account.Name}"/>
                    <apex:inputField value="{!Account.Phone}"/>
                    <apex:inputField value="{!Account.Industry}"/>
                    <apex:inputField value="{!Account.AnnualRevenue}"/>
                </apex:pageBlockSection>
                <apex:pageBlockButtons >
                    <apex:commandButton action="{!save}" value="Save"/>
                    
                    <input type="submit" onclick="back();" value="Cancel"/>
                
                </apex:pageBlockButtons>
            </apex:pageBlock> 
        </apex:form>
    </apex:page>
1
  • Redirect Page within - I don't think is a valid option for us. The page above is just a sample, we have multiple pages like this for some objects that we have packaged. Secondly, it will require lot more efforts to adjust the same to accommodate Classic environment as well. The back button should redirect back to original place such as Tab List or Related List etc from where NEW action was originally called from. – VarunC Oct 28 '20 at 10:27
0

Salesforce logged a Known Issue for this now. Link Known Issue

Support communicated that it is part of next patch in platform, and will be reflected on this KI once it is updated by R&D team.

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.