当前位置: 代码迷 >> 综合 >> Salesforce -- 自定义放大镜查找界面
  详细解决方案

Salesforce -- 自定义放大镜查找界面

热度:92   发布时间:2023-12-19 02:03:29.0

如图,重写放大镜的查找界面

这里写图片描述

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>
  相关解决方案