Steps:
1.Make an HTML web resource in CRM.
2. Make a button using ribbon editor in CRM. And in
action give URL of web resource so that when you click on button it will open the
web resource.
3. Now we want to get object type code of an entity
on which button is added. Get object type code from URL using javascript. This is the full code of web resource it also contains javascript code to get object type code from URL and to open selected div when button press from different entities(to make help document with different materail to show.) Only add your html in div and enjoy.
<html>
<head>
<script src="ClientGlobalContext.js.aspx"></script>
<script
type="text/javascript"
src="new_jquery_1.4.1.min.js"></script>
<script
type="text/javascript">
function getParam ( sname )//function to get url
{
var params =
location.search.substr(location.search.indexOf("?")+1);
var sval = "";
params =
params.split("&");
// split param and value into
individual pieces
for (var i=0; i<params.length;
i++)
{
temp = params[i].split("=");
if ( [temp[0]] == sname ) { sval = temp[1]; }
}
return sval;
}
function foo() // function to open Web resource on specific
entities
{
var bar =
getParam("type");
if(bar=="1" )
{
document.getElementById('cont').style.display
= "none";
}
else if (bar=="2" )
{
document.getElementById('ac1').style.display =
"none";
}
}
</script>
</head>
<body
onload="foo()">
<div
id="ac1" style="display:block" >
<h2>Create
or edit an accounts</h2>
<h4>Applies
To</h4>
<ul>
<li>Microsoft
Dynamics CRM Online</li>
<li>Microsoft
Dynamics CRM 2013</li>
<li>CRM
for web browsers</li>
<li>CRM
for Outlook</li>
</ul>
</div>
<div id="cont"
style="display:block">
<h2>Create or edit an contact</h2>
<h4>Applies To contact</h4>
<ul>
<li>Microsoft
Dynamics CRM Online</li>
<li>Microsoft
Dynamics CRM 2013</li>
<li>CRM
for web browsers</li>
<li>CRM
for Outlook</li>
</ul>
</div>
</body>
</html>