RE: Set field visibility based on owners business unit
Hi..
You cannot use JavaScript in business unit.. you need to add JavaScript on form Onload event
and your javascript code will be look like
function ShowHideByOwnerBU()
{
// get owner Id
var owner= Xrm.Page.getAttribute("ownerid").getValue();
var ownername = owner[0].name;
var ownerId= owner[0].id;
// Get owner Business unit..
// Based on owner BU show/hide fields.
}
To add javascript to form event..
1. you need to create javascript web resource.
2. add this web resource to your entity form script libarary.
3. then call function on form onload event.
Here are some additional links might help you..
[View:http://www.dynamicscrmpros.com/getting-started-with-javascript-form-scripting-for-microsoft-dynamics-crm-2011/:550:0]
[View:https://msdn.microsoft.com/en-us/library/gg334481.aspx:550:0]
[View:https://msdn.microsoft.com/en-us/library/gg309562.aspx:550:0]
[View:https://msdn.microsoft.com/en-us/library/jj602964.aspx:550:0]
Hope this will help..