I came across with a requirement where i have to Hide the Item from Fly-Out Anchors/ Short cuts in CRM, Because You can not remove Items from Fly-Outs, the work around is to Close the form with a User-friendly message using JavaScript on load of the form. You can Security based code also. Closing the UI is not posiible through Plug-Ins, Only possible way to do this using Javascript.
The Close method is available for CRM UI : Xrm.Page.ui.close();
Using this method will a prompt with a dialog box (Find the image below)
To get rid of this Dialog box is to implement getSubmitMode method of attribut, Following the code below to implement it.
Create a Webresource : new_CloseForm
add the following Javascript
function Close()
{
var attributes = Xrm.Page.data.entity.attributes.get();
for (var x in attributes)
{ attributes[x].setSubmitMode("never"); }
alert ("XXX Form is not available for Current logged-in User");
Xrm.Page.ui.close();
}
Add the event method as Close to the desired entity's form. Find the image
Hope this helps.
The Close method is available for CRM UI : Xrm.Page.ui.close();
Using this method will a prompt with a dialog box (Find the image below)
To get rid of this Dialog box is to implement getSubmitMode method of attribut, Following the code below to implement it.
Create a Webresource : new_CloseForm
add the following Javascript
function Close()
{
var attributes = Xrm.Page.data.entity.attributes.get();
for (var x in attributes)
{ attributes[x].setSubmitMode("never"); }
alert ("XXX Form is not available for Current logged-in User");
Xrm.Page.ui.close();
}
Add the event method as Close to the desired entity's form. Find the image
Hope this helps.

