Conditional lightning components rendering in community

Conditional lightning components rendering in community



We have a lightning community for partner registrations with users from multiple profile types. We need to change the contents of the Home page based on the current logged in user. Currently I'm doing it by a VF pages; [I have a VF page component on the main page of my Lightning community template]. This main VF page will redirect to another VF page based on the current user. This works fine.
But I want to do the same with lightning components. So that I will have a main component and that will redirect/render to another component based on the current user. Can I do this? Please share any lead




2 Answers
2



You can use Audience Targeting.



There is step-by-step process in Salesforce Documentation: Manage Audience Targeting for Pages and Groups in Communities.





Thanks! it will somewhat helps me. But what if I want to display a different page for same profile based on some criteria? For example the current accounts status? one page if its 'new', and another one if its 'completed'?
– L Mudiyanse
Sep 2 at 12:41





Then you would need a custom layout that validates your criteria serverside and add conditional rendering
– glls
Sep 2 at 12:47





I understood the validate serverside via controller. Can you elaborate more about adding custom layout?
– L Mudiyanse
Sep 2 at 12:53





You would do that in Lightning Component. (I guess that's what @glls meant by saying custom layout)
– Michal Vavra
Sep 2 at 13:04



Always try and leverage Audience targeting first, however, if you need to further customize what is displayed in your page, you should create either a custom Theme Layout or community Layout. The difference being that the Cusotm Theme layout allows you to modify the whole community Theme (header, footer, body...) and the Layout only the Body of a page in a theme layout.



Thanks for contributing an answer to Salesforce Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Some of your past answers have not been well-received, and you're in danger of being blocked from answering.



Please pay close attention to the following guidance:



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)