I'm searching to get the name of the current view of a record list. Is there a way to do it?
-
Xrm.Page.data.entity.getEntityName() See the Client Side API Documentation. msdn.microsoft.com/en-us/library/gg328255.aspxIamSilviu– IamSilviu2018-04-24 09:50:17 +00:00Commented Apr 24, 2018 at 9:50
-
Xrm.Page.data is not available in a record list (note that by "record list" I don't mean a subgrid in an entity form)Dremor– Dremor2018-04-24 13:43:12 +00:00Commented Apr 24, 2018 at 13:43
Add a comment
|
1 Answer
You can use the below script to get the view name from ribbon:
var viewName = '';
if (crmGrid && crmGrid.control) {
viewName = crmGrid.control.get_viewTitle();
}
Update:
I don't see a supported way to do it. But there are some unsupported solution (may be only way, I haven't tested it personally)
function HideButtonBasedOnViewSelected (selectedCtrl) {
var query = selectedCtrl.get_viewTitle();
if (query == 'Your View Name') {
return false;
}
else
return true;
}
Add Crm parameter, and set parameter value as SelectedControl
To get selected view name need to use some unsupported JavaScript.
3 Comments
Dremor
crmGrid is undefined.
Arun Vinoth PrecogTechnologies
@Dremor based on your crm version you may need to pass primarycontrol as crm parameter in ribbon & try to consume control from formcontext
Dremor
tried primaryControl earlier, result in a null object.