Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Retrieve ScopeGroupId from asset in liferay 7.1
Can i retrieve The scope group id from an asset (no theme display)I'm going to call fetchLayoutByUuidAndGroupId but i am on a child site and if i call the method in this way i get error because i'm on a child site.
<p><#assign layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") </p>
<p> articleLayout = layoutLocalService.fetchLayoutByUuidAndGroupId(assetRenderer.getArticle().getLayoutUuid(), themeDisplay.getScopeGroupId() , false) </p>
<p>friendlyUrl = articleLayout.getFriendlyURL(locale) </p>
<p> /> </p>
I need to recover the scope group id where the asset was been created.
<p><#assign layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") </p>
<p> articleLayout = layoutLocalService.fetchLayoutByUuidAndGroupId(assetRenderer.getArticle().getLayoutUuid(), themeDisplay.getScopeGroupId() , false) </p>
<p>friendlyUrl = articleLayout.getFriendlyURL(locale) </p>
<p> /> </p>
I need to recover the scope group id where the asset was been created.
I am not really sure what you are trying to do here, but if you need the groupId of the article, couldn't you just call assetRenderer.getArticle().getGroupId()?
Perfect, thank you very much!
Can i request you the last thing? Can i retrive the groupid of a parent site ?
A site is a group. So if you can just use getParentGroupId() to get the id of the parent site (if it has one)
https://docs.liferay.com/portal/7.0/javadocs/portal-kernel/com/liferay/portal/kernel/model/Group.html
https://docs.liferay.com/portal/7.0/javadocs/portal-kernel/com/liferay/portal/kernel/model/Group.html
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™