Tuesday, November 1, 2011

how to add photo, image in ms crm 2011 frame

Some times we need to add photo to a contact or account records in ms crm 2011.
this can be done in bit tricky.
u should have the mapping photos in your system.
then just follow the followings...
1. create an iframe in the header of the account/conact form
2. add the web resource to it
3. create the web resource
 source code for web resource

<HTML><HEAD>
<META charset=utf-8>
<SCRIPT>
function chagePic(){
var _name = this.parent.document.getElementById("firstname").value;
if(_name != null & _name.length > 0){
document.getElementById("photo").src = "/_imgs/images/"+_name+".jpg";
}
}
</SCRIPT>
</HEAD>
<BODY contentEditable=true onload=chagePic()>
<DIV style="POSITION: relative; TOP: -14px; LEFT: -9px"><IMG style="WIDTH: 217px; HEIGHT: 162px" id=photo src="/_imgs/images/sample.jpg" width=229 height=162> </DIV></BODY></HTML>

here, in js, it will fetch the first name of the contact from the contact form.
and the photo name should be in that name as well in the system.
keep a sample photo, which will be used, if the photo in the name is not available in the system.

No comments:

Post a Comment