Message Boards
PortalUtil.getPlidFromPortletId not working
Randy Leonard, modified 3 Years ago.
PortalUtil.getPlidFromPortletId not working
New Member Posts: 11 Join Date: 2/9/07 Recent Posts
I am attempting to create a link from one portlet to another, where the two portlets reside in different pages. Note the two pages do exist in the same bundle.I've used this extensively in Liferay 6.x, but identical code is not working in Liferay 7.3.4.The code I am using to generate this link is as follows:
----
The Component declaration for the page to which I am generating a link is as follows:
The generated page is as follows, demonstrating an invalid result for PortalUtil.getPlidFromPortletId:
The result I am getting for PortalUtil.getPlidFromPortletId() is zero, which should not be the case. The resulting link to the intended page does not work.
Again, this used to work just fine my prior projects built with Liferay 6.2. I am not getting the same success with Liferay 7.3.4.Curious if anyone has had similar issues.
Thanks,
Randy
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%>
<%@ taglib uri="http://liferay.com/tld/frontend" prefix="liferay-frontend"%>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet"%>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme"%>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui"%>
<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util"%>
<liferay-theme:defineobjects />
<portlet:defineobjects />
<%
long myThemeId = themeDisplay.getScopeGroupId();
String orgCreatePortletName = com.xyz.portal.masterdata.organization.constants.OrganizationPortletKeys.OrganizationCreate;
long orgCreatePlid = com.liferay.portal.kernel.util.PortalUtil.getPlidFromPortletId(myThemeId, orgCreatePortletName);
%>
<liferay-portlet:renderurl var="orgCreateUrl" portletname="<%=orgCreatePortletName%>" plid="<%=orgCreatePlid%>">
<liferay-portlet:param name="productId" value="1234" />
</liferay-portlet:renderurl>
<br>
myThemeId: <%=myThemeId%>
<br>
orgCreatePlid: <%=orgCreatePlid%>
<br>
orgCreatePortletName: <%=orgCreatePortletName%>
<br>
<a href="${orgCreateUrl}">Create new Organization</a>
----
The Component declaration for the page to which I am generating a link is as follows:
@Component(immediate = true, property = {
"com.liferay.portlet.display-category=" + OrganizationPortletKeys.OrganizationCategory,
"com.liferay.portlet.header-portlet-css=/css/main.css",
"com.liferay.portlet.instanceable=true",
"javax.portlet.display-name=Organization - Create",
"javax.portlet.init-param.template-path=/",
"javax.portlet.init-param.view-template=/organizationCreate/view.jsp",
"javax.portlet.init-param.copy-request-parameters=true",
"javax.portlet.name=" + OrganizationPortletKeys.OrganizationCreate,
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=power-user,user"
}, service = Portlet.class)
public class OrganizationCreatePortlet extends MVCPortlet
The generated page is as follows, demonstrating an invalid result for PortalUtil.getPlidFromPortletId:
myThemeId: 20122
orgCreatePlid: 0
orgCreatePortletName: com_xyz_portal_masterdata_organization_OrganizationCreatePortlet
The result I am getting for PortalUtil.getPlidFromPortletId() is zero, which should not be the case. The resulting link to the intended page does not work.
Again, this used to work just fine my prior projects built with Liferay 6.2. I am not getting the same success with Liferay 7.3.4.Curious if anyone has had similar issues.
Thanks,
Randy
Olaf Kock, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsRandy Leonard:
You know, refusing to link crossposts is even worse than not linking them. Because crossposts generate duplicate work for volunteers that don't know your question has been answered elsewhere.
I am attempting to create a link from one portlet to another, where the two portlets reside in different pages.
But, as on one of your crossposts, you state
Randy Leonard on an unlinked crosspost:
Could you please stop responding to my posts. Just ignore my post if you are so upset I decided to do an experiment on which of two platforms is best for Liferay questions.
I thought it would only be a fair comparison of the platforms if people on both sides knew that your problem might have already been covered elsewhere.
Good luck - let us know about the ultimate platform
Randy Leonard, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
New Member Posts: 11 Join Date: 2/9/07 Recent Posts
why are you being this way... your comments on StackOverflow have been thankfully removed. But you just won't stop.
Olaf Kock, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsRandy Leonard:
why are you being this way... your comments on StackOverflow have been thankfully removed. But you just won't stop.
Here's a quick explanation, if that didn't come through well enough in the stackoverflow meta post that I've linked at your stackoverflow crosspost:
You've crossposted the identical question to multiple sites. You're asking volunteers to help you for free. And we all are happy to provide that free support.
But as soon as a crosspost happens, which doesn't link to the other crossposts, you're generating duplicate work: People in one place are not aware of answers in the other place. Nor do they know additional questions/clarifications from the other site. But we're all providing our support for free. As a minimum courtesy towards your unpaid supporters, is it asked too much to be made aware that the question might be answered already?
And if you don't care about the people potentially helping you: Consider those with a similar question that come after you. They might just find one of the locations - and if that's the one without an answer, and without a link to the crosspost(s), they will get unnecessarily frustrated.
Personally, I've decided to disengage as soon as I see a crosspost, for the reasons stated above, and there are enough questions available that respect free support, that I'd rather concentrate on them.
Sometimes I point to the etiquette (like I did with your posts). Seeing links between crossposts as etiquette or courtesy from your end: Why are you being this way? Don't you value the time and effort of people supporting you for free?
Randy Leonard, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
New Member Posts: 11 Join Date: 2/9/07 Recent Posts
I have never cross posted in my life, but on this one issue when I got no essentially no views on Stack Overflow. So I thought I'd try here. I didn't even think it would be an issue, the term cross-posting never even occurred to me.
And when I get answers to any posts I get, I always share with the community. Always.
You have been relentless in beating up on me. I think the solution is that I just stay away from this forum.
And when I get answers to any posts I get, I always share with the community. Always.
You have been relentless in beating up on me. I think the solution is that I just stay away from this forum.
Olaf Kock, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsRandy Leonard:
Sorry if it felt like I beat you up - I'd say I (persistently) asked to link your crossposts and didn't mean to do anything else but this.
You have been relentless in beating up on me. I think the solution is that I just stay away from this forum.
It's not like I don't help (which you can see all over the forums here, and even in another post of yours)
No bad feelings at all on my end. Even my persistent ask is not a bad feeling for me
Randy Leonard, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
New Member Posts: 11 Join Date: 2/9/07 Recent Posts
I don't know... I'm sure you are a great guy. But I'm just exhausted by this.
Randy Leonard, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
New Member Posts: 11 Join Date: 2/9/07 Recent Posts
I've figured this out, the answer is on Stack Overflow.https://stackoverflow.com/questions/63975811/liferay-portalutil-getplidfromportletid-not-working/64041090#64041090
Olaf Kock, modified 3 Years ago.
RE: PortalUtil.getPlidFromPortletId not working
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsRandy Leonard:
I've figured this out, the answer is on Stack Overflow.https://stackoverflow.com/questions/63975811/liferay-portalutil-getplidfromportletid-not-working/64041090#64041090
Thank you for linking to the answer to this question.
Everything else aside: This is how crossposts can be valuable: The answer is finally available on both ends.
(my initial reservation was for hidden crossposts - without links. Upvoted on SO ;) )