Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Changing the Image when a form field changes.

$
0
0

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.


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>