Modifying the values of User Select field of Email Editor Screen in Sage CRM – Part 2

By | August 22, 2017

Hi Folks!! This blog is in continuation of our previous blog wherein we explained how you can modify the values or the names that are been displayed in User select field of Email Editor Screen in Sage CRM. You can refer below link for the same.
Related Stuff: Modifying the values of User Select field of Email Editor Screen in Sage CRM
Now as you fiddled the standard functionality of CRM, so as to include values from tables other than CRM Users; you also need to make sure to that these values are easily searchable through the finder associated with the User select field.
Now for searching the values added into the user select field follow the below steps:
1.    Create a JavaScript page (e.g. SearchUser.js) with below Code in “<installation path>”\WWWRoot\js\custom” folder.
crm.ready(function()
{
var sAct=crm.getArg(“Act”,crm.url());
if(sAct==”” || sAct==”null”      || sAct==”undefined”)sAct=””;
var sKey0=crm.getArg(“Key0″,crm.url());
if(sKey0==”” || sKey0==”null” || sKey0==”undefined”)sKey0=””;
if(sKey0==”8″ && sAct==”1500″)
{
setHiddenVal();
$(“#comm_useridInput”).attr(‘onchange’,’comm_useridInputonchangeCustom()’);
}
});
function comm_useridInputonchangeCustom()
{
if($(‘#Copycomm_userid’))
{
var items = $(“#Copycomm_userid > option”).map(function()
{
var arr = [];
arr.push([$(this).val(), $(this).text()]);
return arr;
}).get();
var sels = items;
var json = { };
for(var i = 0, l = sels.length; i < l; i++)
{
json[sels[i][0]] = sels[i][1];
}
console.log(eval(json));
var i=0;var lc=0;var floc=window;if(opener)floc=opener;
if(!floc.parent.EWARE_LOGO)floc=floc.parent;
if(!floc.parent.EWARE_LOGO)floc=floc.parent;floc=floc.parent.EWARE_LOGO;
var list=eval(json);var tdoc=document;var name=’comm_useridInput’;
var version=100;var selectbox=document.getElementById(‘comm_userid’);
var fname=window.name; var addblank=true; var noversioncheck=true;
var ibv=tdoc.getElementById(name).value;
var l; var s=false;var p=-1; selectbox.options.length=0;
if (!eval(‘userslistver’)) return 1;
if (version!=eval(‘userslistver’)&&(!noversioncheck))
{if(opener)
{if(opener.name==’EWARE_MID’)
{opener.SelectPopWinX=window;
AddSelectOption(selectbox,tdoc,”,”Please wait…”,false);
floc.location=’/CRMTEST/eware.dll/Do?SID=’+crm.getArg(“SID”,crm.url())+’&Act=10 1&Mode=1&CLk=&LB=’+name+’&FN=POPUPWIN’;
fInUpdate=true;return 1;
}}
Else
{
AddSelectOption(selectbox,tdoc,”,”Please wait…”,false);
floc.location=’/CRMTEST/eware.dll/Do?SID=’+crm.getArg(“SID”,crm.url())+’&Act=101&Mode=1&CLk=&LB=’+name+’&FN=’+fname;
fInUpdate=true;
return 1;
}}
ibv=ibv.toLowerCase();
lc=0;
for (i in list){
l=list[i].toLowerCase();
if (l.indexOf(ibv)!=-1)
{var lselected;
if ((l.indexOf(ibv)==0)&&(s==false))
{
lselected=true;s=true;
}
else lselected=false;
AddSelectOption(selectbox,tdoc,i,list[i],lselected);
lc++;
if(lc>100)
{
AddSelectOption(selectbox,tdoc,”,”Too Many Records”,false);break;
}}}
if ($(“#comm_userid”).length > 0)
$(“#comm_userid option”).sort(SortByName).appendTo(“#comm_userid”);
if ($(“#comm_useridPick”).length > 0)
$(“#comm_useridPickoption”).sort(SortByName).appendTo(“#comm_useridPick”);
if (addblank)
{
if ((s==false) && (selectbox.options[0]!=null)) selectbox.options[0].selected=true;
}           }
}
function setHiddenVal()
{
var x = document.createElement(“SELECT”);
x.setAttribute(“id”, “Copycomm_userid”);
x.setAttribute(“hidden”, “true”);
document.body.appendChild(x);
$(“#comm_userid > option”).map(function() {
var z = document.createElement(“option”);
z.setAttribute(“value”, $(this).val());
var t = document.createTextNode($(this).text());
z.appendChild(t);
document.getElementById(“Copycomm_userid”).appendChild(z);
}).get();}
Now after saving the code, search the values in user select field, you will find the record as shown in below screen shot.

Also Read:
1.    Additional Emails Notifications in Sage CRM v7.3
2.    Print Icon on Email Summary Screen.
3.    Provision to filter Emails Only in CRM
4.    How to disable Embedded Email Editor in Sage CRM?
5.    Add an Auto Signature in Email body in Sage CRM

3 thoughts on “Modifying the values of User Select field of Email Editor Screen in Sage CRM – Part 2

  1. Pingback: ส่งพัสดุ

  2. Pingback: 보증업체

  3. Pingback: link

Comments are closed.