I know I am missing something simple , but I cant see it ... help please
When I get to my 3rd alert , my "selectedRate" is coming back undefined , no error
function UpdateRateLogo() {
alert("WML");
try {
var selectedRate = null;
var showSelectedRateLogo = null;
var lookupItem = null;
var rLogo = false;
var webResourceName = null;
//get value option set value
alert("WML2");
if (Xrm.Page.getAttribute('leadqualitycode').getOptions() != null) {
//Get the Business Unit value
lookupItem = Xrm.Page.getAttribute('leadqualitycode').getOptions();
//Check if lookup is not null
if (lookupItem != null) {
selectedRate = lookupItem[0].name;
alert("WML: " + selectedRate);
if (selectedRate == "Cold") {
webResourceName = 'im_Cold';
rLogo = true;
}
elseif (selectedRate == "Warm") {
webResourceName = 'im_Warm';
rLogo = true;
}
elseif (selectedRate == "Hot") {
webResourceName = 'im_Hot';
rLogo = true;
}
elseif (selectedRate == "Qualified") {
webResourceName = 'im_Qualified';
rLogo = true;
}
elseif (selectedRate == "New Lead") {
webResourceName = 'im_NewLead';
rLogo = true;
}
//Check if logo exists as a web resource
if (rLogo) {
//get Logo based on selectedRate
showSelectedRateLogo = Xrm.Page.context.getClientUrl() + '/WebResources/' + webResourceName;
//alert("WML: " + showSelectedRateLogo);
}
else {
//alert("WML: blank");
//get Logo based on selectedRate
showSelectedRateLogo = "about:blank";
}
}
// alert(showSelectedBULogo);
//var IFrame = Xrm.Page.getControl("IFRAME_Rate");
//IFrame.setSrc(showSelectedRateLogo);
//IFrame.setVisible(true);
var IFrame = Xrm.Page.getControl("IFRAME_Rate");
IFrame.setVisible(true);
window.setTimeout(
function () {
return IFrame.setSrc(showSelectedRateLogo);
}, 1000);
//Xrm.Page.ui.controls.get);
// IFrame.setVisible(true);
}
}
catch (e) {
alert('showRateLogo' + e.description);
}
}
// JavaScript source code