There are no supported way to achieve that, this workaround is not supported and it's not the true field level security!
The file you need to modify is: \CRMWeb\_forms\print\print.aspx
Add the following code just before the 〈/html〉 tag.
<!--
Field level security on Print form
author: Jim Wang @ July 2009
http://jianwang.blogspot.com
-->
<script language="javascript">
var printFrame = document.getElementById("printMain");
var printWindow = document.frames["printMain"];
printFrame.onreadystatechange = function()
{
if(window.opener && printWindow.document.readyState == "complete")
{
//hide attributes
var allFields = opener.document.getElementsByTagName("TD");
for (var i = 0; i < allFields.length; i++)
{
var thisField = allFields[i];
if (thisField.style.display == "none")
{
printWindow.document.getElementById(thisField.id).style.display = "none";
}
}
//hide tabs
var printTabs = printWindow.document.getElementsByTagName("DIV");
var openerTabs = opener.document.getElementsByTagName("LI");
for (var i = 0; i < openerTabs.length; i++)
{
var openerTab = openerTabs[i];
if (openerTab.className && openerTab.className == "ms-crm-Tab")
{
if(opener.document.getElementById(openerTab.id).style.display == "none")
var printTab = printTabs[openerTab.id.replace("tab","").replace("Tab","")];
printTab.style.display = "none";
}
}
}
}
</script>
10 comments:
Hi, Jim.
You can remove this fields from ResultSet returned to the client. This can be done trough handling Execute, Retrieve and RetrieveMultiple messages. I know that my solution isn't perfect, but it works. Check this - http://a33ik.blogspot.com/2009/06/field-security-level-with-own-hands.html.
Thanks A33IK,
You have provided another workaround for unsupported field level security solution, does it work in Advanced Find too? Hopefully MS will add it into CRM 5.0.
Cheers,
Jim
Jim,
I tried to use the code given ,But when i click the print preview i get the same page with Error on Page at the bottom.The error details is "Message:is null or not an object".Also is it possible to bring web pages in IFrames on print preview?
I am trying this for past 2 days
Another way is to replace the print preview with a secured solution. Here's a convenient way to do it: http://adrian-alexan.blogspot.com/2009/12/customizing-entities-print-preview-form.html
Hi Jim Wang,
I've tried your code but somehow when i click close button on the print preview page instead of printing, a CRM error page is displayed.
The error page displayed is the one with the url of
http://servername/organisationname/_common/error/dlg_scriptError.aspx/
The beginning of the pop up dialog error page is
"Microsoft Dynamics CRM has encountered an error.
Please tell Microsoft about this problem.
"
Hope you could help me with this problem as the error message does not indicate to me roughly where does the error originate from and I'm rather new to CRM.
Thanks alot.
Don't work on my CRM
Keep up the fantastic piece of work, I read few blog posts on this web site and I believe that your site is real interesting and has lots of great information. ERP Software in Mumbai || System Software || CRM Software in Mumbai || MLM Software
I really appreciate spending some time to talk about that, I believe firmly regarding this and so really enjoy understanding more about this kind of subject.This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this. CRM Software || MLM Software in Mumbai || ERP Software || System Software in Mumbai
Updated version of Test Bank For Public Relations Strategies And Tactics 11th Edition Instant Download available for instant download. Avail great discounts and offers now.
Post a Comment