0

We need to use existing VF pages in lightning experiences. We changed the styling using standard attribute lightningStylesheets="true".

But apex:pageMessages seems to be not working on those VF pages.Can we do something for this? Otherwise we need to remove apex:pagemessages from all our pages and use some other way to display errors.

1

According to documentation, The apex:pageMessages is supported in Lightning with lightningstylesheet=true without any additional style.

I have checked and verified it using below code:-

<apex:page standardController="Opportunity" recordSetVar="opportunities"
    tabStyle="Opportunity" sidebar="false" lightningStylesheets="true">
    <p>Enter an alphabetic character for the "Close Date," 
       then click Save to see what happens.</p>
    <apex:form >
        <apex:pageBlock >
        <apex:pageMessages />
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!save}"/>
        </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!opportunities}" var="opp">
                <apex:column value="{!opp.name}"/>
                <apex:column headerValue="Close Date">
                    <apex:inputField value="{!opp.closeDate}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

enter image description here

  • Thank you so much for helping me out. Acutualy, I was showing the page message on constructor. It was visible on classic but on lightning it didn't got displayed. So I added it inside the output panel and rendered it true with a flag inside constructor. Now It worked. – Pankaj Andhale Oct 9 '20 at 8:18

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.