Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Javascript code for hiding sections in the form

$
0
0

Hi,
I am trying to write a javascript code for hiding few sections based on certain conditions.
I have a section in the main form with a subgrid.This section is for entering users to the exclusion list.(below picture is the subgrid opened)
So whoever will be in this list should not be able to see few sections in the main form.

The sections to hide will be entered in the entity exclusion list and they are not all required.

So there can be only one entity or all entities(or sections).

My code what I've written so far.. but I am completely stuck at the point how to retrieve the entity lists that have to be hidden.

Can someone please look into it and let me know..

function hideSectionOnLoad(){
Xrm.Page.getAttribute("new_memberexclusion").addOnChange(onMyLookupChange);
}

function onMyLookupChange(){
var lookupField =newArray();
    lookupField
=Xrm.Page.getAttribute("new_memberexclusion").getValue();

   
if(lookupField!=null)
   
{

       
var name = lookupField[0].name;
       
var guid = lookupField[0].id;
       
if(name== Xrm.Page.context.getUserName())//here I want to see if the logged in user is in exclusion list

{
            
Xrm.Page.getControl(" ").setVisible(false);//I am stuck here how to proceed?
       
}
   
}

}

Also is it possible to customize Advanced Find for this purpose if user searches for these sections in Advanced FInd, he should not be able to look at them from here as well. Can this be done?

Thank you in advance.


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>