WhatId search scope (polymorphic) and Visualforce

Can I access the WhatId search scope (polymorphic picklist) in Visualforce as a separate element. See attachment to get the full picture.

enter image description here

Answer

enter image description here

I am sure this is not the best way but this is my way of solving this issue.

Criteria : The whatid is the first lookup on the page, if you have multiple lookups .

I am hiding the first lookup value on the page. You need to modify the openlookup() method related to the onclick event related to the custom lookup to pickup the picklist value.

<apex:page standardController="task">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js"/>
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js"/>
<script type="text/javascript">
$j = jQuery.noConflict();
$j( document ).ready(function() {
  $j('.lookupInput').first().hide();
});

</script>
<apex:form >
<apex:inputField value="{!task.whatId}"/>
<apex:inputField value="{!task.ownerid}"/>
</apex:form>
</apex:page>

Attribution
Source : Link , Question Author : Michael Gill , Answer Author : Rao

Leave a Comment