function Mtc_entityOnChange(){null!=Xrm.Page.getAttribute("mtccup_entity")?Xrm.Page.getControl("mtccup_queryid").setDisabled(!1):Xrm.Page.getControl("mtccup_queryid").setDisabled(!0)}var optionSetValue,Entity="";
function onclick(){Entity=null!=Xrm.Page.getAttribute("mtccup_entity")?Xrm.Page.getAttribute("mtccup_entity").getValue():null;null!=Entity&&(optionSetValue=GetObjectTypeCode(Entity));var a="<fetch distinct='true' mapping='logical' output-format='xml-platform' version='1.0'><entity name='goalrollupquery'><attribute name='goalrollupqueryid'/><attribute name='name'/><attribute name='queryentitytype'/><order descending='true' attribute='createdon'/><filter type='and'>",a=void 0!=optionSetValue?a+("<condition attribute='queryentitytype' value='"+
optionSetValue+"' operator='eq'/>"):a+"<condition attribute='queryentitytype' operator='null'/>",a=a+"</filter></entity></fetch>";Xrm.Page.getControl("mtccup_queryid").addCustomView("{9BBD6E40-5B40-E311-8773-005056C00008}","goalrollupquery","Rollup Queries For Selected Entity",a,"<grid name='resultset' object='1' jump='name' select='1' icon='1' preview='1'><row name='result' id='goalrollupqueryid'><cell name='name' width='300' /><cell name='queryentitytype' width='100' /></row></grid>",!0)}
function GetObjectTypeCode(a){try{var c=new parent.RemoteCommand("LookupService","RetrieveTypeCode");c.SetParameter("entityName",a);var b=c.Execute();return b.Success&&"number"==typeof b.ReturnValue?b.ReturnValue:null}catch(d){alert("Error while getting ETC by Name \u2013 "+d.description)}}
function calendarScreen(){window.open(Xrm.Page.context.getClientUrl()+"/WebResources/mtccup_/CalendarUIPro/Html/GroupCalenderScreen.Html?data="+Xrm.Page.data.entity.getId(),"mywindow","menubar=1,resizable=1,height=800,width=800")}function copyToClipboard(){var a=Xrm.Page.context.getClientUrl()+"/WebResources/mtccup_/CalendarUIPro/Html/GroupCalenderScreen.Html?data="+Xrm.Page.data.entity.getId();window.prompt("Copy to clipboard: Ctrl+C, Enter",a)}
function fnDisableFlyAnchor(){return 1==Xrm.Page.ui.getFormType()?!1:!0};