我需要在案例详细信息页面的电子邮件相关列表中的“发送电子邮件”按钮中添加一些网址参数。
我添加了一个带有执行javascript的自定义详细信息页面按钮。下面是按钮代码。
var loc;
var uRoleId = UserInfo.getUserRoleId();
if(
"{uRoleId}" == "General Permissions Team"){
loc = "/ui/core/email/author/EmailAuthor?p2_lkid=0031500001e729m&rtype=003&p3_lkid=5001500000TkUwp&retURL=%2F5001500000TkUwp&p26=xyz@gmail.com";
}
else{
loc = "/ui/core/email/author/EmailAuthor?p2_lkid=0031500001e729m&rtype=003&p3_lkid=5001500000TkUwp&retURL=%2F5001500000TkUwp&p26=test@gmail.com";
}
window.top.location.href = loc;
现在当我点击按钮时,我收到一条javascript错误,表明没有定义用户信息。 你能帮我指出按钮代码的问题吗。
答案 0 :(得分:0)
UserInfo在JavaScript中不可用。相反,您需要使用{!$ UserRole.Name}来获取角色。
试试这个:
var loc;
var uRoleName = "{!$UserRole.Name}";
if( uRoleName == "General Permissions Team"){
loc = "/ui/core/email/author/EmailAuthor?p2_lkid=0031500001e729m&rtype=003&p3_lkid=5001500000TkUwp&retURL=%2F5001500000TkUwp&p26=xyz@gmail.com";
}
else {
loc = "/ui/core/email/author/EmailAuthor?p2_lkid=0031500001e729m&rtype=003&p3_lkid=5001500000TkUwp&retURL=%2F5001500000TkUwp&p26=test@gmail.com";
}
window.top.location.href = loc;