Hello All,
I have a field in my Lead Entity for Buyer Type, I would like for the Image to be changed once the Buyer Type changes. I know I can't do a workflow or business rule to make this change but I've heard that a JScript will do what I need but I am clueless when it comes to JScripts. Anyone have an example I can use ? I tried to write one myself but keep getting error messages with it, here is the error message:
TypeError: Unable to get property 'Initialize' of undefined or null reference at eval code (eval code:1:1)
My Jscript was:
function SetImage() {
switch (Xrm.Page.getAttribute("tbhc_BuyType").getValue()) {
case 1:
Xrm.Page.getControl("tbhc_detective").setSrc("tbhc_BuyType/Detective");
break;
case 2:
Xrm.Page.getControl("tbhc_fighter").setSrc("tbhc_BuyType/Fighter");
break;
case 3:
Xrm.Page.getControl("tbhc_Entertainer").setSrc("tbhc_BuyType/Entertainer");
break;
case 4:
Xrm.Page.getControl("tbhc_Counselor").setSrc("tbhc_BuyType/Counselor");
break;
}
}
Thanks in advance.