Recently we got one request to show custom
website page in CRM from left navigation in MS CRM 2011 based on the entity id.
I am going to share the process so that it can help someone.
In our scenario we need to
- Create left navigation link for custom
web page hosted on intranet website.
- Pass current entity id to custom web
page.
- Custom page should be visible in
associated view iframe.
As we need to pass entity id to custom web
page, so we can create html web resource which will read entity id and will pass
it to custom web page. Follow below steps to create html page:
- Open default solution or you can create
separate solution.
- Navigate to Web Resources and select New
to create new html web resource
- Provide basic details for html web
resource.
- Open html editor and use below code
<html>
<head>
<script
language="javascript">
function SetLeftNavigation() {
var WebPageURL =
"Provide CustomPageURL_Change";
//change custom page url
var EntityId =
window.parent.Xrm.Page.data.entity.getId();
//to access entityid from entity
form
EntityId =
EntityId.replace('{',
'').replace('}',
'');
var iFramUrl = WebPageURL +
"?id=" + EntityId;
location.href =
iFramUrl;
}
</script>
</head>
<body>
<script
language="javascript">
SetLeftNavigation()
</script>
</body>
</html>
- Save and publish your web resource.
- Open your entity form, where we want to
add left navigation.
- Double click on left navigation section
where you want to add custom link.
- Navigate to Insert->Navigation Link to
add new link.
- Enter details like below
Name - Label that you
want to give to custom link
Icon - you can create
a custom image web resource and use it for icon
Web Resource - Select
the html web resource we just created.
- Save and publish your changes and test
it.