Hi David,<br><br>Popup.php is the entry point for the showing records for selection in vtiger CRM. <br><br>There exists a hook in it to customize the query:<br><span><span style="font-family: courier new,monospace;">// vtlib customization: To override module specific popup query for a given field</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">$override_query = false;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">if(method_exists($focus, &#39;<span style="background-color: rgb(255, 255, 153);">getQueryByModuleField</span>&#39;)) {</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">            $override_query = $focus-&gt;getQueryByModuleField(vtlib_purify($_REQUEST[&#39;srcmodule&#39;]),<br>           vtlib_purify($_REQUEST[&#39;forfield&#39;]), vtlib_purify($_REQUEST[&#39;forrecord&#39;]));</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">            if($override_query) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                        $query = $override_query;</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">     }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">// END<br>
<br></span></span><span>See if it helps.</span><span><br></span><span style="font-family: monospace;"><br></span>Regards,<br>Prasad<br>vtiger Team <br><br><div><span class="gmail_quote">On 6/11/10, <b class="gmail_sendername">David V.</b> &lt;<a href="http://davidv.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">davidv.net</a>@<a href="http://gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Prasad,<br><br>Thank you for your reply. But if I correctly understant what you are saying the function &#39;custom_related_list&#39; I would create would filter the records shown in the related list.<br><br>The list that displays in more information tab (the related list) is NOT the one I want to filter.<br>



<br>I want to filter the content of the popup that shows when I click a button to select a record to add to that related list.<br><br>I want to make it easier for my users to find the record they want. And I want to make it impossible for them to select an unappropriate record.<br>

<span>

<br clear="all">David V.</span><div><span><br>
<br><br><div class="gmail_quote">On Fri, Jun 11, 2010 at 1:28 AM, Prasad <span dir="ltr">&lt;<a href="mailto:prasad@vtiger.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">prasad@vtiger.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi David,<br><br><span><span style="font-family: courier new,monospace;">function setRelatedList($moduleInstance, $label=&#39;&#39;, $actions=false, $function_name=&#39;get_related_list&#39;)</span><br></span><span style="font-family: monospace;"><br>




</span>In case you need to filter the records, I would suggest you to create a function &#39;custom_related_list&#39; in your module and<br>register it by passing the last argument to setRelatedList.<br><br>get_related_list function is made available through data/CRMEntity.php<br>




<br>Regards,<br>Prasad<br>vtiger Team<br><br><div><div><div></div><div><span class="gmail_quote">On 6/11/10, <b class="gmail_sendername">David V.</b> &lt;<a href="http://davidv.net" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">davidv.net</a>@<a href="http://gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">gmail.com</a>&gt; wrote:</span></div>



</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
The setRelatedList API is extremely important for us who need to adapt Vtiger to specials requirements.<br><br>One question I still have is : is it possible to pre-filter the records in the windows that pops-up when I click Add on a related list ?<br>






<br>Exemple : I have a module Payslip. I want it to be related to the module Account so I can select Accounts to add to the More information tab of a specific Payslip.<br><br>I use the setRelatedList API as described in VtigerCRM_5.1.0_Vtlib.pdf and it works perfectly.<br>






<br>Now suppose that I want to show only a subset of the Accounts when I click on the Add button in the related list. For example I want to display only accounts from a specific city.<br><br>Is there already a way to do that ?<br>






<br>If not, would it be possible to add an other argument to the setRelatedList API ?<br><br>Vtiger_Module-&gt;setRelatedList(&lt;TARGET MODULE&gt;[, &lt;HEADER LABEL&gt;, &lt;ALLOWED ACTIONS&gt;, &lt;CALLBACK FUNCTION NAME&gt;, &lt;FILTER FUNCTION NAME&gt;]);<br>






<br>&lt;FILTER FUNCTION NAME&gt;<br>Optional (default = everything)<br>The function should be defined in the &lt;SOURCE MODULE&gt; class.<br>This should filter the records in the &lt;TARGET MODULE&gt; popup before displaying.<br>




<span>

<br><br clear="all">David V.<br>
</span><br></div></div>_______________________________________________<br>
Join vtiger community at <a href="http://forums.vtiger.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://forums.vtiger.com</a><br></blockquote></div><br>
<br>_______________________________________________<br>
Join vtiger community at <a href="http://forums.vtiger.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://forums.vtiger.com</a><br></blockquote></div><br>
</span></div><br>_______________________________________________<br>
Join vtiger community at <a href="http://forums.vtiger.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://forums.vtiger.com</a><br></blockquote></div><br>