Message Boards

Retrieve ScopeGroupId from asset in liferay 7.1

Salvatore Taddeo, modified 4 Years ago.

Retrieve ScopeGroupId from asset in liferay 7.1

New Member Posts: 5 Join Date: 7/10/19 Recent Posts
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.
thumbnail
Christoph Rabel, modified 4 Years ago.

RE: Retrieve ScopeGroupId from asset in liferay 7.1

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
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()?
Salvatore Taddeo, modified 4 Years ago.

RE: Retrieve ScopeGroupId from asset in liferay 7.1

New Member Posts: 5 Join Date: 7/10/19 Recent Posts
Perfect, thank you very much!
Salvatore Taddeo, modified 4 Years ago.

RE: Retrieve ScopeGroupId from asset in liferay 7.1

New Member Posts: 5 Join Date: 7/10/19 Recent Posts
Can i request you the last thing? Can i retrive the groupid of a parent site ?
thumbnail
Christoph Rabel, modified 4 Years ago.

RE: Retrieve ScopeGroupId from asset in liferay 7.1

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
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