<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Can we get portletId and PlId without request object?</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113469980" />
  <subtitle>Can we get portletId and PlId without request object?</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113469980</id>
  <updated>2026-04-03T19:07:55Z</updated>
  <dc:date>2026-04-03T19:07:55Z</dc:date>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114438391" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114438391</id>
    <updated>2019-07-25T14:17:37Z</updated>
    <published>2019-07-25T14:17:37Z</published>
    <summary type="html">Interesting -- how long does this calculation take to run for any given page? I am asking for two reasons --&lt;br /&gt;1. If it is pretty quick, then why not run it on render so that the links are always up to date and accurate? (but I am guessing perhaps it takes too long to calculate to do this?)&lt;br /&gt;2. I&amp;#39;m inclined to agree with Olaf. You have it working which is great, but it&amp;#39;s an odd solution. The reason I say that is because you have both a process that is changing portlet settings, but a user can also change the settings. The process will (eventually) win every time of course, but that could be confusing for a user that doesn&amp;#39;t know about the process. If the category is the driving factor for the links, I&amp;#39;d be inclined to use service builder to generate a table/entity that stored the metrics and then get the portlets to read that table on render. &lt;br /&gt;&lt;br /&gt;With that said, I&amp;#39;m still not entirely sure i understand your use case so perhaps my approach has some shortfalls that I am not clear on.</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2019-07-25T14:17:37Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114425387" />
    <author>
      <name>Mohamed Saleem</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114425387</id>
    <updated>2019-07-25T02:30:13Z</updated>
    <published>2019-07-25T02:30:13Z</published>
    <summary type="html">Hi Andrew,I have asked one question related to remote staging, i am strucking to get data from remote server. can you please help me. please go through this link &lt;a href="https://liferay.dev/forums/-/message_boards/message/57220126"&gt;https://liferay.dev/forums/-/message_boards/message/57220126&lt;/a&gt;</summary>
    <dc:creator>Mohamed Saleem</dc:creator>
    <dc:date>2019-07-25T02:30:13Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114423053" />
    <author>
      <name>Mohamed Saleem</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114423053</id>
    <updated>2019-07-25T02:23:55Z</updated>
    <published>2019-07-25T02:23:55Z</published>
    <summary type="html">Hi Andrew,Yes , changes depends on asset category and admin added  portlet in some other pages. If admin added the portlet to some other pages or change the asset category in page configuration , next schedule it should change,  for every time page is added to the preference, we increasing count of linked page. initially linked count should be zero. based on calculation i mentioned above, we sorted the list by ascending order and added in the portlet prefernce. &lt;br /&gt;&lt;br /&gt;thanks,&lt;br /&gt;Saleem. </summary>
    <dc:creator>Mohamed Saleem</dc:creator>
    <dc:date>2019-07-25T02:23:55Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114424105" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114424105</id>
    <updated>2019-07-25T01:58:07Z</updated>
    <published>2019-07-25T01:58:07Z</published>
    <summary type="html">Hi Mohammed,Thanks for getting back to me &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt;. That&amp;#39;s an interesting scenario. So let&amp;#39;s say your portlet is on page x. The scheduler runs today, does some calculations a d sets 5 plids (excluding page x) for the portlet -- sounds like related assets in a way. When the job runs again tomorrow does it change the 5 links for the portlet on page x? Or are those links set the one time only .. but you run the job daily incase that same portlet is added to a different page?</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2019-07-25T01:58:07Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114422383" />
    <author>
      <name>Mohamed Saleem</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114422383</id>
    <updated>2019-07-25T01:04:54Z</updated>
    <published>2019-07-25T01:04:54Z</published>
    <summary type="html">Hi Andrew Jardine,I have one custom portlet and added in multiple pages, I n this portlet I have to show 5 pages links per portlet (not current pages) in current site using asset category based calculation. The calculated value should be more than 70% matching the category of the current page. Every day scheduler will run at the time calculation will do and storing the plids in Portlet Preferences. To achieve this I want Portlet preference object, so i am using the below code to get portlet preferences.&lt;br /&gt;DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(&lt;br /&gt;                com.liferay.portal.kernel.model.PortletPreferences.class, PortalClassLoaderUtil.getClassLoader());&lt;br /&gt;        dynamicQuery&lt;br /&gt;                .add(PropertyFactoryUtil.forName(&amp;#34;portletId&amp;#34;).like(&amp;#34;%&amp;#34; + SamplePortletKeys.Sample + &amp;#34;%&amp;#34;));&lt;br /&gt;        List&amp;lt;com.liferay.portal.kernel.model.PortletPreferences&amp;gt; portletPreferences = PortletPreferencesLocalServiceUtil&lt;br /&gt;                .dynamicQuery(dynamicQuery);&lt;br /&gt;and looping out the portlet preferences. &lt;br /&gt;&lt;br /&gt;Regards,Saleem.</summary>
    <dc:creator>Mohamed Saleem</dc:creator>
    <dc:date>2019-07-25T01:04:54Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114412651" />
    <author>
      <name>Andrew Jardine</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114412651</id>
    <updated>2019-07-24T14:02:53Z</updated>
    <published>2019-07-24T14:02:53Z</published>
    <summary type="html">Hi Mohamed, That is certainly one way to do it and I&amp;#39;m glad you got it solved. I am curious though, what would the scheduler need to store? and why for a specific portlet on a specific page only?Normally scheduled tasks are supposed to represent system level functions, like CRON jobs on a unix system. I&amp;#39;ve done a lot of work with them and the message bus (in Liferay) over the years and I have never had occasion to do something like you are describing so I am curious to understand more of what you are doing. Can you shed some light?</summary>
    <dc:creator>Andrew Jardine</dc:creator>
    <dc:date>2019-07-24T14:02:53Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114405936" />
    <author>
      <name>Mohamed Saleem</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=114405936</id>
    <updated>2019-07-24T12:12:49Z</updated>
    <published>2019-07-24T12:12:49Z</published>
    <summary type="html">Hi Olaf,sorry for late reply, I have done this requirement.&lt;br /&gt;* getting portletid from portletkeys file  and companyid from PortalUtil .&lt;br /&gt;*Using Dynamicquery  with two property(portletId and companyId), I got the Portletpreference Object. Then I stored my data into it.&lt;br /&gt;thanks,&lt;br /&gt;Saleem</summary>
    <dc:creator>Mohamed Saleem</dc:creator>
    <dc:date>2019-07-24T12:12:49Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113472372" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113472372</id>
    <updated>2019-04-30T13:06:54Z</updated>
    <published>2019-04-30T13:06:54Z</published>
    <summary type="html">&lt;blockquote&gt;Mohamed Saleem&lt;br /&gt;In scheduler I want to store the some value in Portlet Preference Table.&lt;br /&gt;&lt;br /&gt;to acheive this i want portletPreference object. getting preference object i need plid and portletId.&lt;br /&gt;&lt;/blockquote&gt;I&amp;#39;d recommend to store your scheduler&amp;#39;s output somewhere else, where you can also access it from your portlet. This way your scheduler is only doing its business and has no ties into Liferay&amp;#39;s API. Plus, it doesn&amp;#39;t need to determine which of the potentially many portletPreferences to write to. &lt;br /&gt;&lt;br /&gt;Your portlet and your scheduler then have a common backend, which they both access. Definitely a cleaner way to introduce those dependencies.</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2019-04-30T13:06:54Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113471688" />
    <author>
      <name>Mohamed Saleem</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113471688</id>
    <updated>2019-04-30T13:03:24Z</updated>
    <published>2019-04-30T13:03:24Z</published>
    <summary type="html">Hi Olaf,&lt;br /&gt;In scheduler I want to store the some value in Portlet Preference Table.&lt;br /&gt;&lt;br /&gt;to acheive this i want portletPreference object. getting preference object i need plid and portletId.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;thanks,&lt;br /&gt;Saleem.</summary>
    <dc:creator>Mohamed Saleem</dc:creator>
    <dc:date>2019-04-30T13:03:24Z</dc:date>
  </entry>
  <entry>
    <title>RE: Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113471026" />
    <author>
      <name>Olaf Kock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113471026</id>
    <updated>2019-04-30T12:39:46Z</updated>
    <published>2019-04-30T12:39:46Z</published>
    <summary type="html">&lt;blockquote&gt;Mohamed SaleemI want to get plId and portlet id in scheduler class. How can I get these Ids any one please help me?&lt;br /&gt;&lt;/blockquote&gt;a plid is associated with the page a portlet may be placed on. Thus it&amp;#39;s not related to the portlet and there might be multiple plids for a single portlet - and they might all be spread across multiple portal instances (companyId in the API) and sites (scopeGroupId or groupId in API).&lt;br /&gt;&lt;br /&gt;So - yes, you can find out, which pages your portlet is placed on, you&amp;#39;ll most likely need to decide which of the potentially multiple ones you want to use. &lt;br /&gt;&lt;br /&gt;For the portletId: It depends on which one you mean: There&amp;#39;s the one hardcoded id that a portlet has (comes with your portlet), and in case you can add multiple portlets of the same kind on a page, they&amp;#39;ll have their own instance Ids (not to confuse with &amp;#34;portal instance&amp;#34; or &amp;#34;companyId&amp;#34;)&lt;br /&gt;&lt;br /&gt;While this might have been a technically correct answer, I&amp;#39;m not sure it&amp;#39;s too helpful. What do you want to do with them? How do you start your scheduler? What does it do? Maybe there&amp;#39;s another solution than the one that you&amp;#39;re thinking about?</summary>
    <dc:creator>Olaf Kock</dc:creator>
    <dc:date>2019-04-30T12:39:46Z</dc:date>
  </entry>
  <entry>
    <title>Can we get portletId and PlId without request object?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113469979" />
    <author>
      <name>Mohamed Saleem</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113469979</id>
    <updated>2019-04-30T12:21:21Z</updated>
    <published>2019-04-30T12:21:21Z</published>
    <summary type="html">I want to get plId and portlet id in scheduler class. How can I get these Ids any one please help me?</summary>
    <dc:creator>Mohamed Saleem</dc:creator>
    <dc:date>2019-04-30T12:21:21Z</dc:date>
  </entry>
</feed>
