如图,重写放大镜的查找界面
VisualForce:
<script type="text/javascript">function getObjectPrefix(objectName) {
sforce.connection.sessionId = '{!$Api.Session_ID}';var KeyPrefixValue = sforce.connection.describeSObjects([objectName]);var clientPrefix = KeyPrefixValue[0].keyPrefix;console.log('clientPrefix:' + clientPrefix);return clientPrefix;}var materielPrefixid = getObjectPrefix("Account");function openLookup(baseURL, width, modified, searchParam) {
var originalbaseURL = baseURL;var originalwidth = width;var originalmodified = modified;var originalsearchParam = searchParam;var showcustomlookup = false;var lookupType = baseURL.substr(baseURL.length - 3, 3);console.log('lookupType:' + lookupType);if (modified == '1') baseURL = baseURL + searchParam;console.log('searchParam:' + searchParam);console.log('materielPrefixid:' + materielPrefixid);if (lookupType == materielPrefixid) {var urlArr = baseURL.split("&");var txtId = '';if (urlArr.length > 2) {urlArr = urlArr[1].split('=');txtId = urlArr[1];}baseURL = "/apex/AccountLookUp?txt=" + txtId;baseURL = baseURL + "&frm=" + escapeUTF("{!$Component.myForm}");if (modified == '1') {baseURL = baseURL + "&lksearch=" + searchParam;}var company = '';var type = 'OppProduct';var product = '';var buValue = '';var bustr = decodeURIComponent(txtId).replace("materielId", "buValueId");console.log('plIdstr 74:' + bustr);var selectelementbu = document.getElementById(bustr);console.log('selectelementbu 77:' + selectelementbu);if (selectelementbu != null) {if (selectelementbu.children.length > 1) {var valueIndex = selectelementbu.selectedIndex;console.log(valueIndex);if (valueIndex > 0) {buValue = selectelementbu.options[valueIndex].value;console.log('buValue:' + buValue);}}}var plId = '';var plIdstr = decodeURIComponent(txtId).replace("materielId", "selectpl");console.log('plIdstr 74:' + plIdstr);var selectelement = document.getElementById(plIdstr);console.log('selectelement:' + selectelement);if (selectelement != null) {if (selectelement.children.length > 1) {var valueIndex = selectelement.selectedIndex;console.log(valueIndex);if (valueIndex > 0) {plId = selectelement.options[valueIndex].value;}}}baseURL = baseURL + "&type=" + type;baseURL = baseURL + "&company=" + company;baseURL = baseURL + "&buValue=" + buValue + "&plId=" + plId;baseURL = baseURL + "&product=" + product;if (txtId.length > 0) {showcustomlookup = true;}}if (showcustomlookup) {openPopup(baseURL, "lookup", 350, 480, "width=" + width + ",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);} else {if (modified == '1') originalbaseURL = originalbaseURL + originalsearchParam;openPopup(originalbaseURL, "lookup", 350, 480, "width=" + originalwidth + ",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);}}</script>