Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Meera Prince
How to get plid of portlte if portlet is instanicable?
February 10, 2013 9:23 PM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

Hi All ,

I want know the plid of portlet. here my portlet is istanciable.
i want create some url dyanamically from plid . to get plid dynamically i need to pass PortletId. But my portlet is instanciable.
How to get url of portlet dynamically ?

Regards,
Meera Prince
Juhi Kumari
RE: How to get plid of portlte if portlet is instanicable?
February 10, 2013 10:36 PM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
Using themeDisplay object you can get it.
1themeDisplay.getPortletDisplay().getId()


It will return Id of portlet like
Receiver_WAR_Receiverportlet_INSTANCE_Cqz8
So in every instance of your portlet you will get dynamic portlet id with instance id .

Regards
Juhi
Meera Prince
RE: How to get plid of portlte if portlet is instanicable?
February 10, 2013 10:54 PM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

Hi thank you for reply.

but here i want another portletDisplay object not current portletDisplay objet.
my intention is from portlet id i want get PortletDisplay object.
Jitendra Rajput
RE: How to get plid of portlte if portlet is instanicable?
February 10, 2013 11:07 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 848

Join Date: January 7, 2011

Recent Posts

Plid you can also get it by passing friendly URL in LayoutLocalServiceUtil.getFriendlyURLLayout method . Once you have Layout object you can easily get plid from it.
Meera Prince
RE: How to get plid of portlte if portlet is instanicable?
February 10, 2013 11:26 PM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

Hi Jitendra Rajput

Here i don't know where my portlet is placed means which layout my portlet available. i don't know the any information related to layout.
i just know only portlet id but my portlet is instanciable.


Regards,
Meera Prince
Jitendra Rajput
RE: How to get plid of portlte if portlet is instanicable?
February 10, 2013 11:34 PM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 848

Join Date: January 7, 2011

Recent Posts

Did you tried by using below method from PortalUtil. ?

PortalUtil.getPlidFromPortletId(long groupId, String portletId)


1) Try without passing instance id in portlet id (portlet_WAR_name)
2) Try by passing portlet id along with instance details.
Meera Prince
RE: How to get plid of portlte if portlet is instanicable?
February 10, 2013 11:42 PM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

HI Jitendra Rajput,

I tried that one. but in that i should pass PortletId that append with instance key. but here my question is i know portlet id and i can make instance id always same.
some time i delete portlet and i placed new one.
Jitendra Rajput
RE: How to get plid of portlte if portlet is instanicable?
February 11, 2013 12:41 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 848

Join Date: January 7, 2011

Recent Posts

If you remove portlet from page then instance id will be changed ..
Meera Prince
RE: How to get plid of portlte if portlet is instanicable?
February 11, 2013 12:56 AM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

ya you are rite that is my problem. if portlet is non instancable portlet id always same until i change in portlet.xml.

my requirement is i am doing some thing in one portlet after complistion of this i need to navidate to other portlet that is in diffrent layout. here i don't know this layout id and i know only portletId but my portlet is instanciable so i unable to find instance string.
Jitendra Rajput
RE: How to get plid of portlte if portlet is instanicable?
February 11, 2013 1:00 AM
Answer

Jitendra Rajput

Rank: Liferay Master

Posts: 848

Join Date: January 7, 2011

Recent Posts

As per my knowledge there can be 2 option .

1) Either remember friendly URL for layout
2) Make your portlet non instanciable

Update me if you know get better solution for your problem emoticon
Meera Prince
RE: How to get plid of portlte if portlet is instanicable?
February 11, 2013 2:10 AM
Answer

Meera Prince

Rank: Liferay Master

Posts: 860

Join Date: February 8, 2011

Recent Posts

Ya your rite..
Thank you Jitendra Rajput