<?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>Audience Targeting Custom User Segement Rule</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=117602639" />
  <subtitle>Audience Targeting Custom User Segement Rule</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=117602639</id>
  <updated>2026-04-04T12:45:25Z</updated>
  <dc:date>2026-04-04T12:45:25Z</dc:date>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118336934" />
    <author>
      <name>zara rafdh</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=118336934</id>
    <updated>2020-01-24T15:46:43Z</updated>
    <published>2020-01-24T15:46:43Z</published>
    <summary type="html">Thank you guyss </summary>
    <dc:creator>zara rafdh</dc:creator>
    <dc:date>2020-01-24T15:46:43Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117817369" />
    <author>
      <name>Bharamani Tashildar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117817369</id>
    <updated>2019-11-18T13:34:02Z</updated>
    <published>2019-11-18T13:34:02Z</published>
    <summary type="html">HI Eduardo,&lt;br /&gt;any tentative date for next fix pack which includes above issue resolution?&lt;br /&gt;&lt;br /&gt;Thanks</summary>
    <dc:creator>Bharamani Tashildar</dc:creator>
    <dc:date>2019-11-18T13:34:02Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117621817" />
    <author>
      <name>Eduardo P. García</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117621817</id>
    <updated>2021-02-24T16:58:44Z</updated>
    <published>2019-10-31T17:35:57Z</published>
    <summary type="html">Hi Bharamani,Sorry, you were right. That code should be working, but there&amp;#39;s an issue with the JS validation in the segments rules (See &lt;a href="https://issues.liferay.com/browse/WCM-1513"&gt;https://issues.liferay.com/browse/WCM-1513&lt;/a&gt;). I wasn&amp;#39;t aware of it. Until we provide a fix for it, you can provide server-side validation by checking the field values in the processRule method of your Rule class, and throwing an InvalidRuleException when they don&amp;#39;t have the right values.Sorry again for the misunderstanding.Regards</summary>
    <dc:creator>Eduardo P. García</dc:creator>
    <dc:date>2019-10-31T17:35:57Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117618811" />
    <author>
      <name>Bharamani Tashildar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117618811</id>
    <updated>2019-10-31T14:15:24Z</updated>
    <published>2019-10-31T14:15:24Z</published>
    <summary type="html">Hi,&lt;br /&gt;As  i told .. i tried with simple example you shared for default case with IP address to and from. I am unable to figure out exact cause.&lt;br /&gt;&lt;br /&gt;And If you see my view.jsp - its validating when i click outside the box but when i click save it does not validates.&lt;br /&gt;&lt;br /&gt;I request you to provide sample end to end working blade sample.&lt;br /&gt;&lt;br /&gt;Thanks</summary>
    <dc:creator>Bharamani Tashildar</dc:creator>
    <dc:date>2019-10-31T14:15:24Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117615330" />
    <author>
      <name>Eduardo P. García</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117615330</id>
    <updated>2021-02-24T16:58:44Z</updated>
    <published>2019-10-31T13:08:59Z</published>
    <summary type="html">Hi &lt;strong&gt;Bharamani&lt;/strong&gt;,I&amp;#39;d recommend that you start with a very simple rule with just one field, make sure it validates, and then start adding other fields and their validators. Could you try with a simplified version? For instance, only one input text field and its validator for &amp;#34;required&amp;#34;. I observed some issues with your code. You&amp;#39;re setting the id of the aui:input. This is tricky, because the taglib builds this id automatically from the name and prefixes it with the portlet namespace. If you set it manually, then you&amp;#39;d have to include the namespace yourself. I&amp;#39;d recommend that you only set the name attribute, and leave the taglib set for you. &lt;br /&gt;When setting the name, since your rule is multi-instanceable, add the ContentTargetingUtil.GUID_REPLACEMENT. For instance, ContentTargetingUtil.GUID_REPLACEMENT + &amp;#34;myField&amp;#34;.Let me know if it works.</summary>
    <dc:creator>Eduardo P. García</dc:creator>
    <dc:date>2019-10-31T13:08:59Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117614600" />
    <author>
      <name>Bharamani Tashildar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117614600</id>
    <updated>2019-10-31T10:57:54Z</updated>
    <published>2019-10-31T10:57:54Z</published>
    <summary type="html">Hi Eduardo,&lt;br /&gt;can you please help me with the steps to execute default case so that i can apply same in my rule.i am not sure but some where some setting or property need to be added.. because when u click save its not validating rules..</summary>
    <dc:creator>Bharamani Tashildar</dc:creator>
    <dc:date>2019-10-31T10:57:54Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117614178" />
    <author>
      <name>Eduardo P. García</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117614178</id>
    <updated>2021-02-24T16:58:44Z</updated>
    <published>2019-10-31T10:26:25Z</published>
    <summary type="html">Hi Bharamani,The code I shared is valid for non-instanceable rules (default case). For multi-instanceable, you need to include an extra namespace. See:&lt;a href="https://gist.github.com/epgarcia/178df066245955b7288885549a36d581"&gt;https://gist.github.com/epgarcia/178df066245955b7288885549a36d581&lt;/a&gt;&lt;br /&gt;You can see how it works in instanceable rules such as Role Rule, for instance. If you still don&amp;#39;t get it to work, please share your code and I&amp;#39;ll help you.Regards</summary>
    <dc:creator>Eduardo P. García</dc:creator>
    <dc:date>2019-10-31T10:26:25Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117606793" />
    <author>
      <name>Bharamani Tashildar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117606793</id>
    <updated>2019-10-31T03:49:43Z</updated>
    <published>2019-10-31T03:49:43Z</published>
    <summary type="html">Yes, custom rule multi-instanceable. &lt;br /&gt;&lt;br /&gt;And I have used your example as well - same behavior &lt;br /&gt;&lt;a href="https://gist.github.com/epgarcia/a7cf6d40d47845016e1de2e5d330ebfd"&gt;https://gist.github.com/epgarcia/a7cf6d40d47845016e1de2e5d330ebfd&lt;/a&gt;&lt;br /&gt;&lt;a href="https://gist.github.com/epgarcia/a7cf6d40d47845016e1de2e5d330ebfd"&gt;Steps : 1&amp;gt; Created custom module of template &amp;#39;content-targeting-rule&amp;#39; &lt;/a&gt;&lt;br /&gt;               2&amp;gt; replaced view.jsp with content you shared.&lt;br /&gt;               3&amp;gt; still i am able to save with empty &amp;#39;to&amp;#39; and &amp;#39;from&amp;#39; fields.&lt;br /&gt;Do we need to override edit_user_segment.jsp to validate our rule inside &amp;#39;savefields&amp;#39; and &amp;#39;saveAndContinue&amp;#39; js functions?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do we have any Liferay Documentation available to refer?&lt;br /&gt;I searched - No link reference available for 7.1 version(For Audience targeting).</summary>
    <dc:creator>Bharamani Tashildar</dc:creator>
    <dc:date>2019-10-31T03:49:43Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117604488" />
    <author>
      <name>Eduardo P. García</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117604488</id>
    <updated>2021-02-24T16:58:44Z</updated>
    <published>2019-10-30T16:52:02Z</published>
    <summary type="html">Hi Bharamani,This is an example of a rule with validation: &lt;a href="https://gist.github.com/epgarcia/a7cf6d40d47845016e1de2e5d330ebfd"&gt;https://gist.github.com/epgarcia/a7cf6d40d47845016e1de2e5d330ebfd&lt;/a&gt;One extra question: is your custom rule multi-instanceable (i.e. it can be added more than once to the rule builder)?</summary>
    <dc:creator>Eduardo P. García</dc:creator>
    <dc:date>2019-10-30T16:52:02Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117603021" />
    <author>
      <name>Bharamani Tashildar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117603021</id>
    <updated>2019-10-30T15:56:44Z</updated>
    <published>2019-10-30T15:56:44Z</published>
    <summary type="html">Hi Eduardo,&lt;br /&gt;I am using Liferay 7.1 DXP &lt;br /&gt;and liferay audience targeting.lpkg file compatible downloaded from customer site.&lt;br /&gt;&lt;br /&gt;Once we create user segement for custom rule - on clicking save or &amp;#39;save and continue&amp;#39; button the validation should work.&lt;br /&gt;&lt;br /&gt;Thanks</summary>
    <dc:creator>Bharamani Tashildar</dc:creator>
    <dc:date>2019-10-30T15:56:44Z</dc:date>
  </entry>
  <entry>
    <title>RE: Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117603219" />
    <author>
      <name>Eduardo P. García</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117603219</id>
    <updated>2021-02-24T16:58:44Z</updated>
    <published>2019-10-30T15:11:33Z</published>
    <summary type="html">Hi Bharamani,&lt;br /&gt;When adding javascript in a Custom Rule in Audience Targeting, it is specially important to pay attention to the namespacing. That could be the reason why your JS validation is not working. Could you please tell which version of Liferay and AT you are using? This way we can guide you with some examples.&lt;br /&gt;&lt;br /&gt;Regards</summary>
    <dc:creator>Eduardo P. García</dc:creator>
    <dc:date>2019-10-30T15:11:33Z</dc:date>
  </entry>
  <entry>
    <title>Audience Targeting Custom User Segement Rule</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117602638" />
    <author>
      <name>Bharamani Tashildar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=117602638</id>
    <updated>2019-10-30T14:58:43Z</updated>
    <published>2019-10-30T14:58:43Z</published>
    <summary type="html">Hi Team,&lt;br /&gt;&lt;br /&gt;I am creating Custum rule for audience targeting - we have form which validates value - value is mandatory &lt;br /&gt;I have validated with custom javascript code but when we save the form validation is not working &lt;br /&gt;&lt;br /&gt;with empty value also its creating user segment - any settings or property we need to add?&lt;br /&gt;&lt;br /&gt;Please suggest- Thanks in advance.</summary>
    <dc:creator>Bharamani Tashildar</dc:creator>
    <dc:date>2019-10-30T14:58:43Z</dc:date>
  </entry>
</feed>
